Cron
ma cestu : /home/user/Myscript/script.sh
spustil som konzolu normalne ako user a napisal som:
crontab -e
editoval som to na cas:
0 19 * * * /home/user/Myscript/./script.sh
urobil som niekde chybu?
som lama...mozno to poznat....ale snazim sa.....
PS: mam ubuntu HH
Pre pridávanie komentárov sa musíte prihlásiť.
to xyxxx je zakazdym ine
sh -x /home/user/Myscript/./script.sh
a pozri co prislo postou.
crontab -l
ked dam crontab -l, ako root vypise : no crontab for root
ked dam crontab -l pre ucet ako normalny uzivatel, vypise:
# E-mailový výstup na vybranú adresu.
MAILTO=root
# Prestaviť štandardný domovský priečinok.
HOME=/
# Priečinky, v ktorých sa budú vyhľadávať spustiteľné súbory.
PATH=/sbin:/bin:/usr/sbin:/usr/bin
# Prestaviť štandardný shell.
SHELL=/bin/bash
#
40 23 * * * /home/ferinooo/Myscript/Budik.sh
# This file was written by KCron. Copyright (c) 1999, Gary Meyer
# Although KCron supports most crontab formats, use care when editing.
# Note: Lines beginning with "#\" indicates a disabled task.
ferinooo@feronotas:~$
jak to mam zapnut pre root?
ps aux | grep crond
vypise
root 6427 0.0 0.1 2220 780 pts/1 S+ 18:46 0:00 grep crond
a postu pre roota si pozres hoci aj prikazom sudo mail. pokial sa ovsem nepreposiela inemu uzivatelovi.
hladam kde sa da....prikazom cron.....ktory som zadal ako root vybehne
cron: can't lock /var/run/crond.pid, otherpid may be 5472: Resource temporarily unavailable
a pomylilo ma ze je spusteny, ked som si cez start klikol na sluzby a tam bol spusteny planovat /asi anacron
tak ako spustim cron?
na jeho ovladanie mam aj take to klikatko kcron, ale uz bych to zvladol aj v konzole....len nech to funguje.....
#!/bin/sh
# Start/stop the cron daemon.
#
### BEGIN INIT INFO
# Provides: cron
# Required-Start: $syslog $time
# Required-Stop: $syslog $time
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Regular background program processing daemon
# Description: cron is a standard UNIX program that runs user-specified
# programs at periodic scheduled times. vixie cron adds a
# number of features to the basic UNIX cron, including better
# security and more powerful configuration options.
### END INIT INFO
test -f /usr/sbin/cron || exit 0
#LSBNAMES='-l' # Uncomment for LSB name support in /etc/cron.d/
. /lib/lsb/init-functions
case "$1" in
start) log_daemon_msg "Starting periodic command scheduler" "crond"
start-stop-daemon --start --quiet --pidfile /var/run/crond.pid --name cron --startas /usr/sbin/cron -- $LSBNAMES
log_end_msg $?
;;
stop) log_daemon_msg "Stopping periodic command scheduler" "crond"
start-stop-daemon --stop --quiet --pidfile /var/run/crond.pid --name cron
log_end_msg $?
;;
restart) log_daemon_msg "Restarting periodic command scheduler" "crond"
start-stop-daemon --stop --retry 5 --quiet --pidfile /var/run/crond.pid --name cron
start-stop-daemon --start --quiet --pidfile /var/run/crond.pid --name cron --startas /usr/sbin/cron -- $LSBNAMES
log_end_msg $?
;;
reload|force-reload) log_daemon_msg "Reloading configuration files for periodic command scheduler" "crond"
# cron reloads automatically
log_end_msg 0
;;
*) log_action_msg "Usage: /etc/init.d/cron {start|stop|restart|reload|force-reload}"
exit 2
;;
esac
exit 0
chmod u+x /home/user/Myscript/script.sh