I'm trying to get a script with commands that have to be executed as sudo to run daily using cron. I've installed the cron job using

sudo crontab -e

but it doesn't seem to execute...

It's a script that sends me the output of two command on my Plex server in my email every day. When I run this manually (sudo ~/report.sh it does work) This is the script:


touch file.tmp /usr/local/lib/PlexConnect/PlexConnect_daemon.bash
status > file.tmp service plexmediaserver status >> file.tmp 
if [ -s    file.tmp ] 
       mailx -s "Plex daily report $(date)" 8901190836@donboscokortrijk.be <file.tmp 
rm file.tmp

This is the line for the cronjob:

34 15 * * * ~/report.sh

When I run the command manually, I receive the email. When I use it in a crontab, nothing... Any ideas?

1 Answer 1


You're installing a root cronjob when using sudo crontab -e.

~/report.sh will expand to /root/report.sh

Better to use full paths in your cronjob.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.