Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

initctl:command not found

Linux Kernel, Network, and Services configuration.
Post Reply
Message
Author
Eildosa
Posts: 5
Joined: 2015-09-16 08:51

initctl:command not found

#1 Post by Eildosa »

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.

Dai_trying
Posts: 1100
Joined: 2016-01-07 12:25
Has thanked: 5 times
Been thanked: 16 times

Re: initctl:command not found

#2 Post by Dai_trying »

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

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

Re: initctl:command not found

#3 Post by Eildosa »

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

#4 Post by Eildosa »

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

User avatar
debiman
Posts: 3063
Joined: 2013-03-12 07:18

Re: initctl:command not found

#5 Post by debiman »

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"

Post Reply