0

This is the CRON log case computer that runs some scripts (internet-connections oriented):

luis@Fostrot:~$ sudo tail -n 50 /var/log/syslog | grep "cron" -i
Jan 19 21:30:01 Fostrot /USR/SBIN/CRON[11014]: (root) CMD (/bin/bash --login -i -c Reconectador3G.sh)
Jan 19 21:30:01 Fostrot /USR/SBIN/CRON[11013]: (root) CMD (/bin/bash --login -i -c ReportarIP.sh)
Jan 19 21:30:01 Fostrot /USR/SBIN/CRON[11015]: (root) CMD (   /bin/ReconectadorVPN.sh)
Jan 19 21:35:01 Fostrot /USR/SBIN/CRON[11224]: (root) CMD (/bin/bash --login -i -c Reconectador3G.sh)
Jan 19 21:35:01 Fostrot /USR/SBIN/CRON[11227]: (root) CMD (/bin/bash --login -i -c ReportarIP.sh)
Jan 19 21:35:01 Fostrot /USR/SBIN/CRON[11225]: (root) CMD (   /bin/ReconectadorVPN.sh)
Jan 19 21:39:01 Fostrot /USR/SBIN/CRON[11452]: (root) CMD (  [ -x /usr/lib/php5/maxlifetime ] && [ -x /usr/lib/php5/sessionclean ] && [ -d /var/lib/php5 ] && /usr/lib/php5/sessionclean /var/lib/php5 $(/usr/lib/php5/maxlifetime))
Jan 19 21:40:01 Fostrot /USR/SBIN/CRON[11477]: (root) CMD (   /bin/ReconectadorVPN.sh)
Jan 19 21:40:01 Fostrot /USR/SBIN/CRON[11478]: (root) CMD (/bin/bash --login -i -c Reconectador3G.sh)
Jan 19 21:40:01 Fostrot /USR/SBIN/CRON[11481]: (root) CMD (/bin/bash --login -i -c ReportarIP.sh)
Jan 19 21:45:01 Fostrot /USR/SBIN/CRON[11832]: (root) CMD (/bin/bash --login -i -c ReportarIP.sh)
Jan 19 21:45:01 Fostrot /USR/SBIN/CRON[11831]: (root) CMD (   /bin/ReconectadorVPN.sh)
Jan 19 21:45:01 Fostrot /USR/SBIN/CRON[11833]: (root) CMD (/bin/bash --login -i -c Reconectador3G.sh)

And this is the crontab for sudo:

luis@Fostrot:~$ sudo crontab -l
# Edit this file to introduce tasks to be run by cron.
#
# Each task to run has to be defined through a single line
# indicating with different fields when the task will be run
# and what command to run for the task
#
# To define the time you can provide concrete values for
# minute (m), hour (h), day of month (dom), month (mon),
# and day of week (dow) or use '*' in these fields (for 'any').#
# Notice that tasks will be started based on the cron's system
# daemon's notion of time and timezones.
#
# Output of the crontab jobs (including errors) is sent through
# email to the user the crontab file belongs to (unless redirected).
#
# For example, you can run a backup of all your user accounts
# at 5 a.m every week with:
# 0 5 * * 1 tar -zcf /var/backups/home.tgz /home/
#
# For more information see the manual pages of crontab(5) and cron(8)
#
# m h  dom mon dow   command
*/5 * * * * /bin/bash --login -i -c Reconectador3G.sh
*/5 * * * * /bin/bash --login -i -c ReportarIP.sh

As you can see, there is no entry for ReconectadorVPN.sh. The other users have no crontab, or so it seems:

luis@Fostrot:~$ crontab -l
no crontab for luis

I have even checked the crontab for all users:

root@Fostrot:/home/luis# awk -F: '{print $1}' /etc/passwd | xargs -l1 crontab -lu
# Edit this file to introduce tasks to be run by cron.
#
# Each task to run has to be defined through a single line
# indicating with different fields when the task will be run
# and what command to run for the task
#
# To define the time you can provide concrete values for
# minute (m), hour (h), day of month (dom), month (mon),
# and day of week (dow) or use '*' in these fields (for 'any').#
# Notice that tasks will be started based on the cron's system
# daemon's notion of time and timezones.
#
# Output of the crontab jobs (including errors) is sent through
# email to the user the crontab file belongs to (unless redirected).
#
# For example, you can run a backup of all your user accounts
# at 5 a.m every week with:
# 0 5 * * 1 tar -zcf /var/backups/home.tgz /home/
#
# For more information see the manual pages of crontab(5) and cron(8)
#
# m h  dom mon dow   command
*/5 * * * * /bin/bash --login -i -c Reconectador3G.sh
*/5 * * * * /bin/bash --login -i -c ReportarIP.sh
no crontab for daemon
no crontab for bin
no crontab for sys
no crontab for sync
no crontab for games
no crontab for man
no crontab for lp
no crontab for mail
no crontab for news
no crontab for uucp
no crontab for proxy
no crontab for www-data
no crontab for backup
no crontab for list
no crontab for irc
no crontab for gnats
no crontab for nobody
no crontab for libuuid
no crontab for mysql
no crontab for messagebus
no crontab for colord
no crontab for usbmux
no crontab for miredo
no crontab for ntp
no crontab for Debian-exim
no crontab for avahi
no crontab for beef-xss
no crontab for dradis
no crontab for pulse
no crontab for speech-dispatcher
no crontab for haldaemon
no crontab for iodine
no crontab for postgres
no crontab for sshd
no crontab for snmp
no crontab for stunnel4
no crontab for statd
no crontab for sslh
no crontab for Debian-gdm
no crontab for rtkit
no crontab for saned
no crontab for manolo
no crontab for luis
no crontab for dnsmasq
no crontab for arpwatch
no crontab for redsocks

... and none of them have entry for the ReconectadorVPN.sh script.

What is going on here and how could I locate the call to the ReconectadorVPN.sh script?

1

There are a few places that you need to look these days for crontabs:

  1. Of course the individual user crontabs residing usually in /var/spool/cron/ this includes one for the user root as well as other users.

  2. There is a root only crontab in /etc/crontab. From what I remember it contains references to run-parts directories where files with each task are located. These are usually located in /etc/cron.daily /etc/cron.hourly /etc/cron.monthly.

  3. Another area where crontabs can be found these days is under the directory /etc/cron.d/ From what I can tell this seems to be getting to be a more popular place these days. Files in these areas are generally for root level execution.

2

From the cron man page:

   Cron  searches  /var/spool/cron for crontab files which are named after
   accounts in crontabs found are loaded into memory.  Cron also  searches
   for /etc/crontab and the files in the directory, which are in a differ-
   ent format (see crontab(5) ).

You have looked at the user crontabs, but I don't think you've examined /etc/crontab. It usually has entries to run things out of several cron directories.

  • You are right. Thanks you, @BowlOfRed . As long as /etc/crontab is executed as root, I was supposing that it was the same crontab for sudo crontab -l. – Sopalajo de Arrierez Jan 19 '15 at 21:48

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.