I have this script set up as a cron job running as root. plexpy works fine but that is because /usr/local/etc/rc.d/plexpy has nobody:wheel permissions. How can I make the others work with root:wheel permissions? Does my script look ok?
Code:
#!/bin/bash for JAIL in Sonarr Radarr Jackett Plex Transmission Plexpy do jexec $JAIL pkg upgrade -y done for SERVICE in sonarr radarr jackett plexmediaserver transmission plexpy do jexec -u root $JAIL service $SERVICE restart done ### Parameters ### logfile="/tmp/jail_update.tmp" email="myemail@gmail.com" subject="Jails update for FreeNAS" ### Set email headers ### ( echo "To: ${email}" echo "Subject: ${subject}" echo "Content-Type: text/html" echo "MIME-Version: 1.0" echo -e "\\r\\n" ) > ${logfile} ### Set email body ### ( echo "<pre style=\"font-size:14px\">" echo "##### Jails Updated #####" echo "$JAIL" ) >> ${logfile} ### Send report ### sendmail -t < ${logfile} rm ${logfile}