L
L
lmaxximl2012-09-07 07:21:05
linux
lmaxximl, 2012-09-07 07:21:05

Strange behavior of Cron, what's the problem?

Good morning!
There is a small script that checks the connection and if it is not there, it raises the ADSL interface
#!/bin/sh

#Скрипт пингует ya.ru если пинга нет то подымаеться резервный канал на ADSL

/bin/ping -c 2 ya.ru.
if [ $? -ne 0 ]; then.
#если не работает то выполняем действие
/sbin/ifup dsl1
/bin/echo Обрыв основной связи переход на резервный канал!

fi
when launched independently, everything works out with a bang, but through cron it behaves very strange
crontab -l
*/1 * * * * root /root/up
messages
Sep  7 07:55:01 firenat /USR/SBIN/CRON[12260]: (root) CMD (root /root/up)

Sep  7 07:55:01 firenat systemd[1]: Cannot add dependency job for unit amavis.service, ignoring: Unit amavis.service failed to load: No such file or directory. See system logs and 'systemctl status amavis.service' for details.

Sep  7 07:55:01 firenat systemd[1]: Cannot add dependency job for unit cyrus.service, ignoring: Unit cyrus.service failed to load: No such file or directory. See system logs and 'systemctl status cyrus.service' for details.

Sep  7 07:55:01 firenat systemd[1]: Cannot add dependency job for unit ldap.service, ignoring: Unit ldap.service failed to load: No such file or directory. See system logs and 'systemctl status ldap.service' for details.

Sep  7 07:55:01 firenat systemd[1]: Cannot add dependency job for unit amavis.service, ignoring: Unit amavis.service failed to load: No such file or directory. See system logs and 'systemctl status amavis.service' for details.

Sep  7 07:55:01 firenat systemd[1]: Cannot add dependency job for unit cyrus.service, ignoring: Unit cyrus.service failed to load: No such file or directory. See system logs and 'systemctl status cyrus.service'

Sep  7 07:55:01 firenat systemd[1]: Cannot add dependency job for unit ldap.service, ignoring: Unit ldap.service failed to load: No such file or directory. See system logs and 'systemctl status ldap.service' fo

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alukardd, 2012-09-07
@Alukardd

1 - is there really a dot after then? OO Or do you just love to write correctly and put dots at the end of a sentence on Habré?
2 - exclamation mark - this is a special character of the shell, it must be escaped, but it is better to use it in strict (') quotes. It is echoed adequately only because it is the last one on the line.

L
lmaxximl, 2012-09-07
@lmaxximl

All questions are closed.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question