Sample Header Ad - 728x90

RedHat init.d script will not start with service after stop

0 votes
1 answer
2462 views
I have the service script below, which calls a shell script. We changed something in the script When I run the shell script directly, everything works fine. When I restart the servER, everything works fine. If I call sudo service my-service stop then sudo service my-service start, it will stop, but never start again. It says systemctl OK, but a process never kicks off, and no logs are ever written from the shell script. Even if I call sudo /etc/init.d/my-service it won't start. Again, mind you, this will start fine automatically on restart of the server. Any thoughts on what could be the problem, or how to get better logging from this failed start? #!/bin/bash # # my-service # # chkconfig: 345 84 15 # description: Start up the My Service process. # config: /etc/sysconfig/my-service # processname: java # Source function library. . /etc/init.d/functions # Loading the configuration parameters. if [ -f /etc/sysconfig/my-service ]; then source /etc/sysconfig/my-service fi RETVAL=0 case "$1" in start) if [ -f /opt/my-service/latest/bin/my-service-start.sh ]; then logger -s "Starting My Service" /bin/su -p -s /bin/sh myserviceuser /opt/my-service/latest/bin/my-service-start.sh RETVAL=$? [ $RETVAL = 0 ] && touch /var/lock/subsys/my-service fi ;; stop) if [ -f /opt/my-service/latest/bin/my-service-stop.sh ]; then logger -s "Stopping My Service" /bin/su -p -s /bin/sh myserviceuser /opt/my-service/latest/bin/my-service-stop.sh RETVAL=$? [ $RETVAL = 0 ] && rm -f /var/lock/subsys/my-service fi ;; restart) $0 stop $0 start ;; *) echo $"Usage: $0 {start|stop|restart}" exit 1 ;; esac exit $RETVAL
Asked by Spencer Kormos (109 rep)
Nov 4, 2014, 08:00 PM
Last activity: May 19, 2025, 08:07 AM