initctl:command not found

Kernels & Hardware, configuring network, installing services

initctl:command not found

Postby Eildosa » 2017-05-11 08:20

Hi,

So I bought a VPS running Debian 8 and I waned to use it in order to run a python webserver.
I have a xxx.py that I need to run in oder for the web server to be active.

At first I was going to make a init.d script then I learn that upstart should be use instead (/etc/nit)

So I put this cmc.conf in init :

Code: Select all
################################
##### install in /etc/init #####
################################

description "test flask webpage"

start on runlevel [2345]
stop on runlevel [!2345]

exec python /web/cmcreader/cmcr.py >> web/cmcreader/cmcr.log 2>&1
respawn


I then tried to run :

Code: Select all
initctl reload-configuration


but I get

Code: Select all
-bash: initctl: command not found


I was following http://stackoverflow.com/questions/4705 ... aemon?rq=1
I'm logged in via SSH as root.

Any ideas?

Thanks.
Eildosa
 
Posts: 5
Joined: 2015-09-16 08:51

Re: initctl:command not found

Postby Dai_trying » 2017-05-11 08:26

That post is quite old, I think what you would want now is the systemctl comand (systemd) but I'm not very experienced with it so man systemctl mught be useful to you.

HTH
Dai_trying
 
Posts: 317
Joined: 2016-01-07 12:25

Re: initctl:command not found

Postby Eildosa » 2017-05-11 11:29

Oh god.

At first I used init.d then I learned that it's outdated
then upstart and it's outdated,
now I have to re-do it for systemd lol.

Allright, thanks.
Eildosa
 
Posts: 5
Joined: 2015-09-16 08:51

Re: initctl:command not found

Postby Eildosa » 2017-05-11 12:15

So I made this :

Code: Select all
[Unit]
Description=My Script Service
After=multi-user.target

[Service]
Type=idle
ExecStart=/usr/bin/python /web/cmcreader/test.py > /web/cmcreader/test.log 2>&1

[Install]
WantedBy=multi-user.target


I've put it in /lib/systemd/system I then chmoded it :

Code: Select all
chmod 644 /lib/systemd/system/cmcreader.service


I then tried to activate it using :

systemctl daemon-reload
systemctl enable cmcreader.service


however the last command returns (systemctl enable) :

Failed to execute operation: Invalid argument


What did I do wrong?

EDIT :

It was because '>' is not supported by systemd
Eildosa
 
Posts: 5
Joined: 2015-09-16 08:51

Re: initctl:command not found

Postby debiman » 2017-05-11 14:59

Eildosa wrote:It was because '>' is not supported by systemd

so you got it now? solved?

about the redirection to a log file: i don't think you need it with systemd; it should suck up the service's output and you can look at it with journalctl (which has to be made to work on debian systems :-(
or "systemctl status cmcreader"
User avatar
debiman
 
Posts: 1205
Joined: 2013-03-12 07:18


Return to System configuration

Who is online

Users browsing this forum: wizard10000 and 14 guests

fashionable