Cron runs a non-existing variant of . sh script

Nemesis

Member
Joined
Nov 19, 2019
Messages
31
Reaction score
5
Credits
46
I've been encountered a strange phenomena.
I've been messing with Cron, so it runs a script called startup.sh, which it does.
First I wrote the script to send an email, but later I rewrote it to send a message instead.

However, when restarting the server, nothing happened.

Then I checked the status of cron, and was surprised that it had run the old script, which now didn't exist anymore.

Is there some kind of cron cache?


Here I'm checking the status:
hellfire@Plex:~$ sudo systemctl status cron [sudo] password for hellfire:
Code:
● cron.service - Regular background program processing daemon
   Loaded: loaded (/lib/systemd/system/cron.service; enabled; vendor preset: enabled)
   Active: active (running) since Mon 2020-01-20 20:57:56 CET; 1min 45s ago
     Docs: man:cron(8)
Main PID: 537 (cron)
    Tasks: 1 (limit: 3548)
   CGroup: /system.slice/cron.service
           └─537 /usr/sbin/cron -f

Jan 20 20:57:57 Plex cron[537]: (CRON) INFO (pidfile fd = 3)
Jan 20 20:57:57 Plex cron[537]: (CRON) INFO (Running @reboot jobs)
Jan 20 20:57:57 Plex CRON[565]: pam_unix(cron:session): session opened for user root by (uJan 20 20:57:57 Plex CRON[613]: (root) CMD (sleep 20 && /home/hellfire/startup.sh)
Jan 20 20:58:21 Plex sSMTP[866]: Creating SSL connection to host
Jan 20 20:58:21 Plex sSMTP[866]: SSL connection using ECDHE_RSA_AES_256_GCM_SHA384
Jan 20 20:58:21 Plex cron[537]: sendmail: 550 5.7.1 Username [email protected] and sender roJan 20 20:58:21 Plex sSMTP[866]: 550 5.7.1 Username [email protected] and sender [email protected] 20 20:58:21 Plex CRON[565]: (root) MAIL (mailed 75 bytes of output but got status 0x00                                )
Jan 20 20:58:21 Plex CRON[565]: pam_unix(cron:session): session closed for user root
It tried to run the mail script, which don't exist anymore, and it failed (worked before, but that's not the issue)

Then I checked the script file:

hellfire@Plex:~$ cat /home/hellfire/startup.sh
Code:
#!/bin/sh

smsT --command='m "Adam Larsson" Hellfire are ONLINE'

It was the new script, so where did cron run the other (now rewritten script) from?

I've of course restarted Linux, I've even tried to clear the cache, but it don't work..
.. So now I'm confused... (More than normal)
 


How does the respective line of the crontab look like? cron does not do any magic: It simply invokes the commands you specify there, under that path.
 
How does the respective line of the crontab look like? cron does not do any magic: It simply invokes the commands you specify there, under that path.
I've actually solved this one, it was an error in a script, (the one you just solved for me), that caused cron to send an email, which failed, and when I saw the error message was about a mail, and not the "messer" script.
I faulty assumed that it was complaining about a previous cron function that was suppose to send a mail upon boot, but I removed it and replaced with the "messer" script.

The cron error messages was the same as when the mail function didn't work, and I assumed it has executed the same (now non-existent) script, but it had executed the right one (messer)..
 

Staff online


Top