Results 1 to 2 of 2

Thread: Cronjob with script with sudo commands not running Ubuntu 16.04

  1. #1
    Join Date
    Feb 2017
    Beans
    9

    Cronjob with script with sudo commands not running Ubuntu 16.04

    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
    Code:
    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:
    Code:
    #!/bin/bash
    
    touch file.tmp /usr/local/lib/PlexConnect/PlexConnect_daemon.bash
    status > file.tmp service plexmediaserver status >> file.tmp 
    if [ -s    file.tmp ] 
    then
           mailx -s "Plex daily report $(date)" 8901190836@donboscokortrijk.be <file.tmp 
    fi 
    rm file.tmp
    This is the line for the cronjob:
    Code:
    34 15 * * * ~/report.sh
    When I run the command manually, I receive the email. When I use it in a crontab, nothing... Any ideas?

  2. #2
    Join Date
    Feb 2017
    Beans
    9

    Re: Cronjob with script with sudo commands not running Ubuntu 16.04


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •