Stopping and Starting Specific Services on boot

Questions about SNMP, Power, System, Logs, disk, & RAID.
Post Reply
User avatar
daNutz
Getting the hang of things
Posts: 72
Joined: Mon May 07, 2012 10:04 pm
Location: London, UK

Stopping and Starting Specific Services on boot

Post by daNutz »

Hi,

I use Container Station and one of the containers is pihole, the requirement i have is;
  1. to stop DNSMASQ starting on boot (stops pihole starting, both use port 53)
  2. to execute my docker compose script after container station has started
How to i achieve this? im familiar with using CLI and WinSCP

thanks for all the help.
TS-1079Pro - 30TB - RAID 6 - FW: 4.3.6.2232 - MultiMedia
TS-453 Pro - 12TB - RAID 5 - OS: Ubuntu Server 22.04.2 / Docker
SelfHosted
NAS Migration Compatibility

ImageImageImageImageImageImageImageImageImageImageImageImageImage
User avatar
daNutz
Getting the hang of things
Posts: 72
Joined: Mon May 07, 2012 10:04 pm
Location: London, UK

Re: Stopping and Starting Specific Services on boot

Post by daNutz »

Ok, currently trying to use OneCD's RunLast with a script that has the following code:

Code: Select all

#!/bin/sh
docker-compose up -d
killall -9 dnsmasq
docker-compose up -d pihole
Unfortunately RunLast seems to be running before container stations is started, even though ive also installed his SortMyQPKG's that has the following order;

Code: Select all

(01) (A) HideThatBanner
(02) (A) Entware
(03) (A) netmgr
(04) (A) container-station
(05) (A) HybridBackup
(06) (Φ) NotificationCenter
(07) (Φ) QuLog
(08) (Φ) ResourceMonitor
(09) (Φ) Qboost
(10) (Φ) SSDLaboratory
(11) (Φ) helpdesk
(12) (Φ) QsyncServer
(13) (Φ) CloudLink
(14) (Φ) LicenseCenter
(15) (Φ) QcloudSSLCertificate
(16) (Φ) sherpa
(17) (Φ) duf
(18) (Φ) ClamAV
(19) (Ω) MalwareRemover
(20) (Ω) RunLast
(21) (Ω) SortMyQPKGs
TS-1079Pro - 30TB - RAID 6 - FW: 4.3.6.2232 - MultiMedia
TS-453 Pro - 12TB - RAID 5 - OS: Ubuntu Server 22.04.2 / Docker
SelfHosted
NAS Migration Compatibility

ImageImageImageImageImageImageImageImageImageImageImageImageImage
User avatar
OneCD
Guru
Posts: 12143
Joined: Sun Aug 21, 2016 10:48 am
Location: "... there, behind that sofa!"

Re: Stopping and Starting Specific Services on boot

Post by OneCD »

daNutz wrote: Sun Jul 25, 2021 7:34 pm Unfortunately RunLast seems to be running before container stations is started, even though ive also installed his SortMyQPKG's that has the following order;
I don't have access to Container Station so I'm unable to test how and when it starts.

Maybe it takes a while to start and doesn't wait for all containers to be up-and-running before releasing control back to QTS to continue processing QPKGs?

You'll need to do some testing and find a workaround. ;)

ImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImage
User avatar
daNutz
Getting the hang of things
Posts: 72
Joined: Mon May 07, 2012 10:04 pm
Location: London, UK

Re: Stopping and Starting Specific Services on boot

Post by daNutz »

OneCD wrote: Mon Jul 26, 2021 2:53 pm
daNutz wrote: Sun Jul 25, 2021 7:34 pm Unfortunately RunLast seems to be running before container stations is started, even though ive also installed his SortMyQPKG's that has the following order;
I don't have access to Container Station so I'm unable to test how and when it starts.

Maybe it takes a while to start and doesn't wait for all containers to be up-and-running before releasing control back to QTS to continue processing QPKGs?

You'll need to do some testing and find a workaround. ;)
Hi, I did do some checks and noticed that RunLast was executing before container station, even though in the QPKG order it is set to be near the end (as per above). not sure how i can diagnose why its being started sooner than it should?
TS-1079Pro - 30TB - RAID 6 - FW: 4.3.6.2232 - MultiMedia
TS-453 Pro - 12TB - RAID 5 - OS: Ubuntu Server 22.04.2 / Docker
SelfHosted
NAS Migration Compatibility

ImageImageImageImageImageImageImageImageImageImageImageImageImage
User avatar
OneCD
Guru
Posts: 12143
Joined: Sun Aug 21, 2016 10:48 am
Location: "... there, behind that sofa!"

Re: Stopping and Starting Specific Services on boot

Post by OneCD »

daNutz wrote: Mon Jul 26, 2021 7:16 pm Hi, I did do some checks and noticed that RunLast was executing before container station, even though in the QPKG order it is set to be near the end (as per above). not sure how i can diagnose why its being started sooner than it should?
Hard-to-say. You may need to hack the QPKG service-script files and insert your own tracking logger (example: something that appends the current NAS uptime to a text file would do) to work out when Container Station initially starts, then as it's loading its containers, then again when it exits, and compare this against the start times for RunLast. It's a pain, but it should help you discover when it starts compared to your other QPKGs. :D

The "theory" RunLast (and SortMyQPKGs) work-on is that QPKGs are started in the order they appear in [/etc/config/qpkg.conf] but I found at-least one exception to that some time back (read the OP here for more info).

ImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImage
User avatar
daNutz
Getting the hang of things
Posts: 72
Joined: Mon May 07, 2012 10:04 pm
Location: London, UK

Re: Stopping and Starting Specific Services on boot

Post by daNutz »

OneCD wrote: Tue Jul 27, 2021 7:11 am
daNutz wrote: Mon Jul 26, 2021 7:16 pm Hi, I did do some checks and noticed that RunLast was executing before container station, even though in the QPKG order it is set to be near the end (as per above). not sure how i can diagnose why its being started sooner than it should?
Hard-to-say. You may need to hack the QPKG service-script files and insert your own tracking logger (example: something that appends the current NAS uptime to a text file would do) to work out when Container Station initially starts, then as it's loading its containers, then again when it exits, and compare this against the start times for RunLast. It's a pain, but it should help you discover when it starts compared to your other QPKGs. :D

The "theory" RunLast (and SortMyQPKGs) work-on is that QPKGs are started in the order they appear in [/etc/config/qpkg.conf] but I found at-least one exception to that some time back (read the OP here for more info).
Unforutenty im not that intelligent, i tried it on my second nas and had the same issue :(

This is what the log says, which is why im assuming container station hasn't started;

Code: Select all

RunLast (20210328)
[Sun Jul 25 12:07:53 BST 2021] begin "start" scripts ...
[Sun Jul 25 12:07:53 BST 2021] -> execute: "'/share/CACHEDEV1_DATA/.qpkg/RunLast/scripts/DockerCompose.sh'" ...
[Sun Jul 25 12:07:53 BST 2021] => exitcode: (127)
[Sun Jul 25 12:07:53 BST 2021] => stdout: ""
[Sun Jul 25 12:07:53 BST 2021] => stderr: "/share/CACHEDEV1_DATA/.qpkg/RunLast/scripts/DockerCompose.sh: line 1: docker-compose: command not found"
[Sun Jul 25 12:07:53 BST 2021] end "start" scripts
───────────────────────────────────────────────────────
TS-1079Pro - 30TB - RAID 6 - FW: 4.3.6.2232 - MultiMedia
TS-453 Pro - 12TB - RAID 5 - OS: Ubuntu Server 22.04.2 / Docker
SelfHosted
NAS Migration Compatibility

ImageImageImageImageImageImageImageImageImageImageImageImageImage
User avatar
daNutz
Getting the hang of things
Posts: 72
Joined: Mon May 07, 2012 10:04 pm
Location: London, UK

Re: Stopping and Starting Specific Services on boot

Post by daNutz »

ok since upgrading to 20210809, im no longer seeing errors in the log, but its also doesn't look to be executing my script :(

Code: Select all

RunLast (20210809)
[Sun Aug  8 20:07:31 BST 2021] begin "start" scripts ...
[Sun Aug  8 20:07:31 BST 2021] end "start" scripts
───────────────────────────────────────────────────────
Last edited by daNutz on Mon Aug 09, 2021 3:41 am, edited 1 time in total.
TS-1079Pro - 30TB - RAID 6 - FW: 4.3.6.2232 - MultiMedia
TS-453 Pro - 12TB - RAID 5 - OS: Ubuntu Server 22.04.2 / Docker
SelfHosted
NAS Migration Compatibility

ImageImageImageImageImageImageImageImageImageImageImageImageImage
User avatar
OneCD
Guru
Posts: 12143
Joined: Sun Aug 21, 2016 10:48 am
Location: "... there, behind that sofa!"

Re: Stopping and Starting Specific Services on boot

Post by OneCD »

Is your script still there?

You might also need to do this too: viewtopic.php?p=796372#p796372 except with the 'docker-compose' command.

ImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImage
User avatar
daNutz
Getting the hang of things
Posts: 72
Joined: Mon May 07, 2012 10:04 pm
Location: London, UK

Re: Stopping and Starting Specific Services on boot

Post by daNutz »

OneCD wrote: Mon Aug 09, 2021 3:38 am Is your script still there?

You might also need to do this too: viewtopic.php?p=796372#p796372 except with the 'docker-compose' command.
You're a superstar, thank you!, its now all working :)
TS-1079Pro - 30TB - RAID 6 - FW: 4.3.6.2232 - MultiMedia
TS-453 Pro - 12TB - RAID 5 - OS: Ubuntu Server 22.04.2 / Docker
SelfHosted
NAS Migration Compatibility

ImageImageImageImageImageImageImageImageImageImageImageImageImage
User avatar
OneCD
Guru
Posts: 12143
Joined: Sun Aug 21, 2016 10:48 am
Location: "... there, behind that sofa!"

Re: Stopping and Starting Specific Services on boot

Post by OneCD »

Good work! :D

ImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImage
Post Reply

Return to “System & Disk Volume Management”