i noticed when typed sudo crontab -e
dont see cron command, when crontab -e
there command.
is there difference between 2? if there is, should put cron command, should in sudo or without sudo?
thanks!
is there difference between 2?
yes, indeed different. difference sudo crontab -e
commands schedule root
user's credentials. commands in sudo's cron table executed root user.
but crontab -e
, commands scheduled regular user logged in.
where should put cron command, should in sudo or without sudo?
well, answer depends on type of command want run.
if command required sudo
access sudo crontab -e
should used.
else if cron command doesn't require special permission use crontab -e
.
example:
if ethernet network interface eth0
should disabled or enabled @ specific time use command
ifconfig eth0 up
or ifconfig eth0 down
above commands require special permission (sudo), these commands supposed added sudo's
cron tab
any other command require minimal permission or no permission removing file tmp
directory $ rm /tmp/somefile
use regular user's crontab.
Comments
Post a Comment