Hi all.
I hope someone will be able to solve this problem.
I’m trying to remake the required functionality for the service from /etc/init.d/ to the systemd.
Part of the script where the start and stop functionality looks like this:
DESC="Veeam Agent for Linux service"
DAEMON=/usr/sbin/$NAME
PIDFILE=/var/run/$NAME.pid
DAEMON_ARGS="--daemonize --pidfile=$PIDFILE"
SCRIPTNAME=/etc/init.d/$NAME
do_start()
{
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \
|| return 1
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \
$DAEMON_ARGS \
|| return 2
}
do_stop()
{
start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME
RETVAL="$?"
[ "$RETVAL" = 2 ] && return 2
start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON
[ "$?" = 2 ] && return 2
# Many daemons don't delete their pidfiles when they exit.
rm -f $PIDFILE
return "$RETVAL"
}
In the snapcraft.yaml I specified this for the service:
apps:
veeamservice:
command: usr/sbin/veeamservice --daemonize
daemon: forking
plugs: [home, network, daemon-notify]
Snap package during installation starts the service, it works.
But if I try to stop it, then do not start it.
Can anyone tell me how to correctly start and stop for the service?
If I try to use command as
command: usr/sbin/veeamservice --start
it’s not worked