Mail regarding service not started


#1

Everytime I log into SSH console I have new mail regarding service not started.

Failed to stop btsync.service: Unit btsync.service not loaded.
Failed to stop sonarr.service: Unit sonarr.service not loaded.

I know I can install the apps and the mail spam stops, but at the moment I don’t need this services. How to disable mail notification for services not loaded/installed.


#2

In your /home/user/.startup file you can append > /dev/null to the commands. Although, the crontab -l injection should take care of this.

Change the BTSYNC section from this:

if [ "$BTSYNC" == "yes" ]; then
  (ps aux|grep btsync >/dev/null && (sudo service btsync start && false))
else
  (ps aux|grep btsync >/dev/null && (sudo service btsync stop && false))
fi

to this and see if it helps:

if [ "$BTSYNC" == "yes" ]; then
  (ps aux|grep btsync >/dev/null && (sudo service btsync start >/dev/null && false))
else
  (ps aux|grep btsync >/dev/null && (sudo service btsync stop >/dev/null && false))
fi

#3

I’ve done the changes and rebooted the server but mails still popping up every minute.


#4

Did you install postfix or sendmail on your system. The mail should not be popping up when the cron is told to ignore the message.

Try this instead:

username=_your_username_
command1="*/1 * * * * /home/${username}/.startup >/dev/null 2>&1"
cat <(fgrep -iv "${command1}" <(sh -c 'sudo -u ${username} crontab -l' >/dev/null 2>&1)) <(echo "${command1}") | sudo -u ${username} crontab -

#5

This did the trick. No more mails popping up when using ssh.

Thank you once again.


#6

Awesome! I have additionally written this into the startup script as an official fix in case others are running into this. Thank you for bringing this to my attention.

The official fix is in and can be pulled with an update.
https://github.com/QuickBox/quickbox_setup/commit/8fccac3b1ee43cc3798324d75752df4e838ef7d8