19-junio-2018
admin

Automatizar tareas en cron

Paso 1/ Instalamos el gnome-schedule

sudo apt-get install gnome-schedule

Paso 2/ Editamos la tabla de tareas

crontab -e
# m h  dom mon dow   command
# * * * * *  command to execute
# - - - - -
# ¦ ¦ ¦ ¦ ¦
# ¦ ¦ ¦ ¦ ¦
# ¦ ¦ ¦ ¦ +----- day of week (0 - 7) (0 to 6 are Sunday to Saturday, or use names; 7 is Sunday, the same as 0)
# ¦ ¦ ¦ +---------- month (1 - 12)
# ¦ ¦ +--------------- day of month (1 - 31)
# ¦ +-------------------- hour (0 - 23)
# +------------------------- min (0 - 59)

0 0 * * * /home/pi/backup.sh

0 */3 * * * sudo service serv1 start
0 */4 * * * sudo service serv2 start

Paso 3/ Podemos listar las tareas con el comando

crontab -l

Nota: Despues de realizar modificaciones es necesario reiniciar el servicio.

sudo /etc/init.d/cron restart

Comentarios cerrados.

Categorias

Linkedin