Reputation: 377
I have h problem, i need to run a backup script with no output to the screen at all the problem is i need to do it only if its running from the crontab in linux.
So if a user open the script it will load the UI menu
But from the crontab i want to add an argument so it will run without any output, something like:
07 00 * * * /root/idan/python nw_backup.py -s
s for silent :)
From my search here i found how to run only one command with subprocess module
Thanks !
Upvotes: 1
Views: 9239
Reputation: 11707
You can just dump all output (stdout and stderr) to /dev/null
.
/root/idan/python nw_backup.py -s > /dev/null 2>&1
2>&1
basically means, dump stderr (2
) same to where you dump stdout (&1
).
Upvotes: 4