0

we are running upstart job on ubuntu 14.04 for so many years, now we are about to move on to the new version of ubuntu as 16.04, But I am unable to create the same job in systemD.

description  "evercam_media"
start on filesystem or runlevel [2345]
stop on runlevel [!2345]
limit nofile 1000000 1000000

respawn
chdir /
setuid root
setgid root

env HOME=/home/root
env LANG=en_US.UTF-8
env LANGUAGE=en_US:en
env LS_ALL=en_US.UTF-8
env ERL_MAX_PORTS=10240
env ERL_MAX_ETS_TABLES=5000
env PORT=4000
env MIX_ENV=prod


exec watch -n1 '/usr/local/bin/run_evercam_media.sh'

post-stop exec sudo pkill beam

while seeing few other people's work I have tried so many things but It's not starting my application, any help will be much-appreciated thanks, Sorry for so less information am very new with this kind fo stuff.

Update:

[Unit]
Description=Runner for My Phoenix App
After=network.target

[Service]
WorkingDirectory=/etc/build/
EnvironmentFile=/etc/default/my_phoenix_app.env
ExecStart=/usr/local/bin/run_evercam_media.sh
ExecStop=sudp pkill beam
User=root
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target
  • I knew you are going to ask that.. I have updated the q – Junaid Farooq Jun 21 '17 at 7:01
  • Please help if you can.. I am have tried so many things. But it's not working, my whole yesterday destroyed due to this and today is also going to be.. I know there is something missing which I dont know so please help if you can – Junaid Farooq Jun 21 '17 at 7:02
0

Your service doesn't have a type.

One of the basic things that should be specified within the [Service] section is the Type= of the service. This categorizes services by their process and daemonizing behavior. This is important because it tells systemd how to correctly manage the service and find out its state.

The Type= directive can be one of the following:

simple: The main process of the service is specified in the start line. This is the default if the Type= and Busname= directives are not set, but the ExecStart= is set. Any communication should be handled outside of the unit through a second unit of the appropriate type (like through a .socket unit if this unit must communicate using sockets).

forking: This service type is used when the service forks a child process, exiting the parent process almost immediately. This tells systemd that the process is still running even though the parent exited.

oneshot: This type indicates that the process will be short-lived and that systemd should wait for the process to exit before continuing on with other units. This is the default Type= and ExecStart= are not set. It is used for one-off tasks.

dbus: This indicates that unit will take a name on the D-Bus bus. When this happens, systemd will continue to process the next unit.

notify: This indicates that the service will issue a notification when it has finished starting up. The systemd process will wait for this to happen before proceeding to other units.

idle: This indicates that the service will not be run until all jobs are dispatched.

From Digital Ocean's Understanding Systemd Units and Unit Files

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.