Skip to content

Instantly share code, notes, and snippets.

@lavoiesl
Forked from anonymous/cron.sh
Last active December 10, 2015 04:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save lavoiesl/4381677 to your computer and use it in GitHub Desktop.
Save lavoiesl/4381677 to your computer and use it in GitHub Desktop.
Run a script with lowest priority
#!/bin/sh
# $$ represents the current PID
# Set to lowest I/O priority
ionice -c idle -p $$
# Set to lowest CPU priority
renice -n -20 -p $$ >/dev/null
# Run a task
date=$(date '+%s')
tar czf /mnt/backups/$date.tar.gz /var/www
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment