7 septiembre, 2024





$ su


$ cd /etc/init.d/

$ vi nombreservicio

#!/bin/bash
# chkconfig: 2345 20 80
# description: Description comes here….


# Source function library.
. /etc/init.d/functions


start() {
    # code to start app comes here
    # example: daemon program_name &


    /ruta/del/archivo/ejecutable/nombrearchivo.sh
    return 1
}


stop() {
    # code to stop app comes here
    # example: killproc program_name
    return 1
}

case “$1” in
    start)
       start
       ;;
    stop)
       stop
       ;;
    restart)
       stop
       start
       ;;
    status)
       # code to check status of app comes here
       # example: status program_name
       ;;
    *)
       echo “Usage: $0 {start|stop|status|restart}”
esac

exit 0
$ chkconfig –add nombreservicio
$ chkconfig –level 2345 nombreservicio on


systemctl enable nombreservicio.service



Deja un comentario

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *