Şansal Birbaş Şansal Birbaş - 2 months ago 36
Linux Question

Run two commands in cron

I need to run a task every hour . I first change directory to the path where script is and then operate that script. So I try to use a cron job as :

59 * * * * cd /home/sansal/Scripts && sudo ./usbreset /dev/bus/usb/002/003

I added that line to crontab. But I cant make sure if it is true. And I dont see any output in terminal about that.


Using the full path is defintely better then first using cd. To get the result of the cronjob, you could just output to file like this:

59 * * * * /home/sansal/Scripts/usbreset /dev/bus/usb/002/003 &>> /home/sansal/usbreset.log