I use an init.d process devolved from https://github.com/mjsilva/rtorrent-screen-debian-init-script/blob/master/rtorrent via https://ubuntuforums.org/showthread.php?t=2231702. It allows me to sudo ... start|stop|restart

#!/bin/bash ### BEGIN INIT INFO # Provides: huck-youtube monitor for lxle0 # Required-Start: $local_fs $remote_fs $network $syslog # Required-Stop: $local_fs $remote_fs $network $syslog # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Start/stop youtube monitor daemon ### END INIT INFO # http://ubuntuforums.org/showthread.php?t=2231702 # https://github.com/mjsilva/rtorrent-screen-debian-init-script/blob/m +aster/rtorrent # sudo update-rc.d youhuckmon defaults 99 # sudo /etc/init.d/youhuckmon start MYLOG="/home/active/you-huck/apiv3/base/huck4you-startup.log.lst" echo `date` $1 >> $MYLOG ## Username to run under ## home directory of this user! USER="phuck" ## start with a cd here CDTO="/home/active/you-huck/apiv3" ## Absolute path to the binary. RUNME="/home/huck/cvs/you-perl/go-you-huck" ## Absolute path to the screen binary. SCREEN="/usr/bin/screen" ## Name of the screen session, you can then "screen -r <SCREEN_NAME>" +to get it back ## to the forground and work with it on your shell. SCREEN_NAME="youtubemon" # Absolute path to PID file. PIDFILE="/var/run/youtube-huck4you.pid" case "$1" in ## Start screen in the background. start) cd $CDTO echo "Starting screen $SCREEN_NAME" | tee -a $MYLOG start-stop-daemon --start --background --oknodo \ --pidfile "$PIDFILE" --make-pidfile \ --chuid $USER \ --chdir $CDTO \ --exec $SCREEN -- -DmUS $SCREEN_NAME $RUNME # --exec $SCREEN -- -LDmUS $SCREEN_NAME $RUNME if [[ $? -ne 0 ]]; then echo "Error: screen $SCREEN_NAME failed to start." | tee - +a $MYLOG exit 1 fi echo "screen $SCREEN_NAME started successfully. " | tee -a $MY +LOG ;; ## Stop . stop) echo "Stopping screen $SCREEN_NAME." | tee -a $MYLOG start-stop-daemon --stop --oknodo --pidfile "$PIDFILE" if [[ $? -ne 0 ]]; then echo "Error: failed to stop $SCREEN_NAME process." | tee - +a $MYLOG exit 1 fi echo "$SCREEN_NAME stopped successfully." | tee -a $MYLOG ;; ## Restart restart) "$0" stop sleep 1 "$0" start || exit 1 ;; ## Print usage information if the user gives an invalid option. *) echo "Usage: $0 [start|stop|restart]" exit 1 ;; esac
it uses screen to capture the sysout and syserr.

phuck is "production-huck" of course :)


In reply to Re: Restarting Perl Socket Server by huck
in thread Restarting Perl Socket Server by Asyf

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.