Skip to content

Instantly share code, notes, and snippets.

@zetavg
Last active August 29, 2015 14:04
Show Gist options
  • Save zetavg/5af279c49a84d92c631c to your computer and use it in GitHub Desktop.
Save zetavg/5af279c49a84d92c631c to your computer and use it in GitHub Desktop.

In vim, press CtrlZ and Enter on the end of line 12.

#!/bin/sh
TASK_ID="AUTO_NCDU_$(date +'%a')"
echo "Starting $TASK_ID"
# Kill existing screen session
/opt/bin/screen -D -RR "$TASK_ID" -X quit || true
# Create screen and start rsync in it
/opt/bin/screen -dmS "$TASK_ID"
/opt/bin/screen -r "$TASK_ID" -p 0 -X stuff "/opt/bin/ncdu /volume1
"
# Notify in DSM at start
/usr/syno/bin/synodsmnotify @administrators "$TASK_ID auto ncdu starting" "Use the command \`# screen -R $TASK_ID\` via ssh to see the progress."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment