Restarting service after changing config/emulation isn't killing old services

Reports of any bugs or issues found when using the Retro-Printer module. Please include details of what equipment you are trying to link to the Retro-Printer module.
Post Reply
keenerb
Posts: 32
Joined: Sun Sep 10, 2023 12:34 am

Restarting service after changing config/emulation isn't killing old services

Post by keenerb »

At boot:

root@Retro-Printer:/var/log# ps -aux | grep esc
root 522 99.7 0.8 34548 8320 ? RN 19:03 15:37 /home/pi/temp/sdl/escparser/retroprinter 4
root 571 0.1 0.8 34204 8320 ? SN 19:03 0:01 /home/pi/temp/sdl/escparser/convert-flasher
root 574 0.1 21.2 223164 197632 ? SN 19:03 0:01 /home/pi/temp/sdl/escparser/convert-escp2 /home/pi/data/ 4 1 1 0 1
root 2738 0.0 0.1 7520 1792 pts/1 S+ 19:19 0:00 grep esc

echo "HP" > /root/config/emulation
service retroprinter restart

root 571 0.1 0.8 34204 8320 ? SN 19:03 0:01 /home/pi/temp/sdl/escparser/convert-flasher
root 574 0.1 21.2 223164 197632 ? SN 19:03 0:01 /home/pi/temp/sdl/escparser/convert-escp2 /home/pi/data/ 4 1 1 0 1
root 2749 99.1 0.9 34548 8576 ? RN 19:19 0:02 /home/pi/temp/sdl/escparser/retroprinter 4
root 2772 2.2 0.8 34204 8320 ? SN 19:19 0:00 /home/pi/temp/sdl/escparser/convert-flasher
root 2774 2.2 0.9 34188 8576 ? SN 19:19 0:00 /home/pi/temp/sdl/escparser/convert-pcl /home/pi/data/ 4 1 1 0 1
root 2792 0.0 0.1 7520 1792 pts/1 S+ 19:19 0:00 grep esc

echo "Epson" > /root/config/emulation
service retroprinter restart

root 571 0.1 0.8 34204 8320 ? SN 19:03 0:01 /home/pi/temp/sdl/escparser/convert-flasher
root 574 0.1 21.2 223164 197632 ? SN 19:03 0:01 /home/pi/temp/sdl/escparser/convert-escp2 /home/pi/data/ 4 1 1 0 1
root 2772 0.3 0.8 34204 8320 ? SN 19:19 0:00 /home/pi/temp/sdl/escparser/convert-flasher
root 2774 0.4 0.9 34188 8576 ? SN 19:19 0:00 /home/pi/temp/sdl/escparser/convert-pcl /home/pi/data/ 4 1 1 0 1
root 2825 98.7 0.9 34548 8448 ? RN 19:20 0:01 /home/pi/temp/sdl/escparser/retroprinter 4
root 2833 3.3 0.8 34204 8192 ? SN 19:20 0:00 /home/pi/temp/sdl/escparser/convert-flasher
root 2835 27.8 21.2 223164 197760 ? SN 19:20 0:00 /home/pi/temp/sdl/escparser/convert-escp2 /home/pi/data/ 4 1 1 0 1
root 2857 0.0 0.1 7520 1792 pts/1 S+ 19:20 0:00 grep esc
RWAP
Site Admin
Posts: 512
Joined: Wed Sep 13, 2017 9:20 pm
Location: Oswestry, Shropshire
Contact:

Re: Restarting service after changing config/emulation isn't killing old services

Post by RWAP »

You need to use

cd /home/pi/temp/sdl/escparser
./retroprinter-restart.sh

Open to ideas how to make the service restart run this!!
Retro-Printer Specialists
RWAP Software
RWAP Adventures
SellMyRetro
Retro-Printer Module

Also Involved in:
Icephorm
keenerb
Posts: 32
Joined: Sun Sep 10, 2023 12:34 am

Re: Restarting service after changing config/emulation isn't killing old services

Post by keenerb »

OK that seems to work, thanks! I don't know much about service startup scripts, sorry!
RWAP
Site Admin
Posts: 512
Joined: Wed Sep 13, 2017 9:20 pm
Location: Oswestry, Shropshire
Contact:

Re: Restarting service after changing config/emulation isn't killing old services

Post by RWAP »

I just realised the problem is that I did not add a restart section to the init.d script!

/etc/init.d/retroprinter should now read:

Code: Select all

#! /bin/sh
### BEGIN INIT INFO
# Provides: noip
# Required-Start: $syslog
# Required-Stop: $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: noip server
# Description:
### END INIT INFO
 
case "$1" in
    start)
        # echo "update RTC Clock"
        # Update clock from RTC Module
        python3 /home/pi/rtc/USB-RTC-Key/UPDATE_RaspberryPi.py
    
        echo "retroprinter will be started"
        # Start Program
        nice /home/pi/temp/sdl/escparser/retroprinter 4 1>>/home/pi/data/retroprinter.log 2>>/home/pi/data/retroprinter-error.log&
        /home/pi/printpcl.sh
        /home/pi/printprintronix.sh
        ;;
    restart)
        echo "retroprinter will be restarted"
        # Stop Program
        killall -s SIGKILL retroprinter
        killall inotifywait
        pkill -9 -f "convert-*"
        # Start Program
        nice /home/pi/temp/sdl/escparser/retroprinter 4 1>>/home/pi/data/retroprinter.log 2>>/home/pi/data/retroprinter-error.log&
        /home/pi/printpcl.sh
        /home/pi/printprintronix.sh
        ;;        
    stop)
        echo "retroprinter will be killed"
        # End Program
        killall -s SIGKILL retroprinter
        killall inotifywait
        pkill -9 -f "convert-*"
        ;;
    *)
        echo "Usage: /etc/init.d/retroprinter {start|stop}"
        exit 1
        ;;
esac
 
exit 0
Retro-Printer Specialists
RWAP Software
RWAP Adventures
SellMyRetro
Retro-Printer Module

Also Involved in:
Icephorm
RWAP
Site Admin
Posts: 512
Joined: Wed Sep 13, 2017 9:20 pm
Location: Oswestry, Shropshire
Contact:

Re: Restarting service after changing config/emulation isn't killing old services

Post by RWAP »

I just realised the problem is that I did not add a restart section to the init.d script!

/etc/init.d/retroprinter should now read:

Code: Select all

#! /bin/sh
### BEGIN INIT INFO
# Provides: noip
# Required-Start: $syslog
# Required-Stop: $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: noip server
# Description:
### END INIT INFO
 
case "$1" in
    start)
        # echo "update RTC Clock"
        # Update clock from RTC Module
        python3 /home/pi/rtc/USB-RTC-Key/UPDATE_RaspberryPi.py
    
        echo "retroprinter will be started"
        # Start Program
        nice /home/pi/temp/sdl/escparser/retroprinter 4 1>>/home/pi/data/retroprinter.log 2>>/home/pi/data/retroprinter-error.log&
        /home/pi/printpcl.sh
        /home/pi/printprintronix.sh
        ;;
    restart)
        echo "retroprinter will be restarted"
        # Stop Program
        killall -s SIGKILL retroprinter
        killall inotifywait
        pkill -9 -f "convert-*"
        # Start Program
        nice /home/pi/temp/sdl/escparser/retroprinter 4 1>>/home/pi/data/retroprinter.log 2>>/home/pi/data/retroprinter-error.log&
        /home/pi/printpcl.sh
        /home/pi/printprintronix.sh
        ;;        
    stop)
        echo "retroprinter will be killed"
        # End Program
        killall -s SIGKILL retroprinter
        killall inotifywait
        pkill -9 -f "convert-*"
        ;;
    *)
        echo "Usage: /etc/init.d/retroprinter {start|stop}"
        exit 1
        ;;
esac
 
exit 0
Retro-Printer Specialists
RWAP Software
RWAP Adventures
SellMyRetro
Retro-Printer Module

Also Involved in:
Icephorm
Post Reply