-
Notifications
You must be signed in to change notification settings - Fork 5
run a rudaux command manually while still getting logging
Tiffany A. Timbers edited this page Jan 17, 2021
·
1 revision
if you ever want to run a rudaux command manually while still getting logging (like how cron does it), you need to remove the backslashes from the time string. So for example in the rudaux_snapshot cron job, you'll see the line:
3 * * * * root cd /home/stty2u; /usr/local/bin/rudaux snapshot 2>&1 | ts '[\%F-\%H:\%M:\%S]' >> "rudaux_snapshot_$(date +"\%Y_\%m_\%d").log"
the 3 * * etc
is the time specifier for cron to run its thing, the root specifies what user to run as, the rest is the command
so you want to take the command
cd /home/stty2u; /usr/local/bin/rudaux snapshot 2>&1 | ts '[\%F-\%H:\%M:\%S]' >> "rudaux_snapshot_$(date +"\%Y_\%m_\%d").log"
and remove the backslashes from the date string
cd /home/stty2u; /usr/local/bin/rudaux snapshot 2>&1 | ts '[\%F-\%H:\%M:\%S]' >> "rudaux_snapshot_$(date +"%Y_%m_%d").log"
and run that as root in the terminal window
basically backslashes do something different in the command prompt than they do in a cron script -_- I know it's stupid, it's stuff like this why I try to avoid shell scripting as much as possible