linux run script at startup centos

i have nodejs App i want run script at startup centos

my script.sh is

#!/bin/bash
cd /home/mb/Desktop/Voip
gulp

my Executing Commands and Scripts at Reboot & Startup in Centos 7 is

crontab -e

@reboot sh /home/mb/Desktop/script.sh

does not work

1 answer

  • answered 2018-02-13 01:16 Gilles Quenot

    The simplest way is to edit /etc/rc.local :

    /bin/sh /home/mb/Desktop/script.sh &
    

    or try to debug your cron :

    crontab -e
    
    @reboot /bin/sh /home/mb/Desktop/script.sh &>/tmp/debug
    

    Then, cat /tmp/debug