0

I have an nginx service and it works perfectly, the only problem is I can't enable it. I followed this thread Not a native service systemd - can't run on boot and did what was told in the accepted answer and I still have a problem.

When I run:

sudo systemctl enable nginx.service

I get:

Synchronizing state of nginx.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable nginx
update-rc.d: error: nginx Default-Start contains no runlevels, aborting.

When I start it with sudo systemctl start nginx.service and run:

sudo systemctl status nginx.service

I am getting:

nginx.service - The NGINX HTTP and reverse proxy server
   Loaded: loaded (/etc/systemd/system/nginx.service; disabled; vendor preset: enabled)
   Active: active (running) since Wed 2020-10-28 08:26:05 UTC; 57min ago
    Tasks: 3 (limit: 2303)
   CGroup: /system.slice/nginx.service
           ├─1281 nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.conf
           ├─2094 nginx: worker process
           └─2095 nginx: cache manager process

Oct 28 08:26:04 vps-cef86568 systemd[1]: Starting nginx.service...
Oct 28 08:26:05 vps-cef86568 nginx[1262]:  * Starting Nginx Server
Oct 28 08:26:05 vps-cef86568 nginx[1262]:    ...done.
Oct 28 08:26:05 vps-cef86568 systemd[1]: Started nginx.service.

My /etc/systemd/system/nginx.service file looks like this:

[Unit]
Description=The NGINX HTTP and reverse proxy server
After=syslog.target network-online.target remote-fs.target nss-lookup.target
Wants=network-online.target

[Service]
Type=forking
PIDFile=/run/nginx.pid
ExecStartPre=/usr/sbin/nginx -t
ExecStart=/usr/sbin/nginx
ExecReload=/usr/sbin/nginx -s reload
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=true

[Install]
WantedBy=multi-user.target

Any suggestions how to enable it?

2
  • cat /var/log/syslog - any entries?
    – Berndinox
    Oct 28, 2020 at 10:05
  • @Berndinox when I try to enable the nginx the only new line in the log is: Oct 28 10:32:07 vps-server-45123945 systemd[1]: Reloading.
    – Don40
    Oct 28, 2020 at 11:33

2 Answers 2

0

For some reason Ubuntu's build of nginx includes both a systemd unit and the obsolete SysV init script that it was meant to replace. This also is present in 20.04 LTS, so upgrading will not help. I would guess some packager just forgot about it; consider opening a report on Launchpad so the maintainers can remove the obsolete script.

For the immediate problem, you probably should use the systemd unit that Ubuntu shipped, rather than your own. Delete the file you created, run systemctl daemon-reload, and then try enabling the service again.

0

sudo /usr/local/smokeping/bin/smokeping --debug

ERROR: /usr/local/smokeping/bin/../etc/config, line 13: table syntax error

After entering the debug command am getting that error

below is the file it is referring to:

owner = cict contact = ***[email protected] mailhost = mail.****za.zm imgcache = /usr/local/smokeping/cache imgurl = cache datadir = /usr/local/smokeping/data piddir = /usr/local/smokeping/var cgiurl = http://155.0.72.158/smokeping.cgi smokemail = /usr/local/smokeping/etc/smokemail.dist tmail = /usr/local/smokeping/etc/tmail.dist syslogfacility = smokeping   *** Alerts *** to = ***[email protected] from = mail@**za.zm +someloss type = loss pattern = >0%,12,>0%,12,>0% comment = loss 3 times in a row

1
  • Not an answer, this is your workaround
    – Turdie
    Jan 31 at 4:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .