Estou mudando do Ubuntu 11 para o 16 e gostaria de converter scripts customizados para trabalhar com o Ubuntu 16
Eu iniciei e concluí o primeiro script de inicialização , mas preciso de ajuda no segundo script de inicialização . Eu completei parte disso, mas não consigo encontrar exemplos on-line para concluí-lo.
Primeiro script de inicializaçãodescription "worker process to start multiple consumers - q9 mt03 local queue"
author "mt dev team"
start on runlevel [2345]
stop on runlevel [!2345]
env NUM_WORKERS=20
pre-start script
for i in 'seq 1 $NUM_WORKERS'
do
start consumer-localhost N=$i
done
end script
Versão Systemd
### BEGIN INIT INFO
Provides: localqueue
Default-Start: 2 3 4 5
Default-Stop: 0 1 6
Short-Description: start and stop service rabbitmq servers
Description: worker process to start multiple consumers - q9 mt03 local queue
Environment NUM_WORKERS=20
ExecStartPre
for i in 'seq 1 $NUM_WORKERS'
do
start consumer-localhost N=$i
done
ExecStopPost
### END INIT INFO
Segundo script de inicialização
description "consumer script as a service - q9 local queue"
author "mt dev team"
stop on stopping worker-localhost
instance $N
# Automatically Respawn:
respawn
respawn limit 70 5
pre-start script
# script to run before restart - notify or logging script
/bin/sh /root/consumer_restart_log.sh localhost pre-start
end script
script
exec /usr/bin/php /root/tracking/consumer.php localhost $N >>/var/log/aws_consumer_output.log 2>&1
end script
post-start script
# script to run before restart - notify or logging script
/bin/sh /root/consumer_restart_log.sh localhost post-start
end script
Script de versão do Systemd
Description "Consumer script as a service "
author "mt dev"
Conflicts=worker-localhost