Synology-Forum.nl

Tweaks / Addons A.K.A. The Underground => Algemeen => Topic gestart door: mc_ op 07 februari 2020, 19:39:39

Titel: Packages opstarten via command line
Bericht door: mc_ op 07 februari 2020, 19:39:39
Ik gebruik sinds kort Monit (package in de bèta repository van Syno Community) om oa Domoticz en MyDomoAtHome te monitoren. De laatste vliegt er nog wel 's uit en Monit start 'm vervolgens keurig weer op. Blij mee dus.

Om Monit te gebruiken dien je de start/stop scripts op te geven van de te monitoren packages. Voor MyDomoAtHome gebruik ik het volgende commando om te starten:

/usr/syno/sbin/synoservice --enable pkgctl-MyDomoAtHomeof
/usr/syno/sbin/synoservice --restart pkgctl-MyDomoAtHome
In beide gevallen start het package, maar in het Package Center staat het pakket nog als inactief (Run knop is beschikbaar).
- is er een verschil tussen starten in Package Center en via command line? Kennelijk wel
- is er een verschil tussen restart en enable?
- gebruik ik het juiste commando om te starten?
Titel: Re: Packages opstarten via command line
Bericht door: Birdy op 07 februari 2020, 23:42:21
Dit zijn de mogelijkheden, met uitleg:

--enable, --disable
Enable or disable the specified service.
Not only the specified service will be saved to the current settings once the service has been enabled or disabled, the service will also be started or stopped immediately.

--start, --stop, --restart
Start, stop, or restart the specified service without modifying the settings.
Before starting the service, it will check if the service has been enabled yet.
Titel: Re: Packages opstarten via command line
Bericht door: mc_ op 08 februari 2020, 16:53:20
Dank, @Birdy. Het bevestigt dat ik beide kan gebruiken. Het verklaart niet waarom de status in Package Manager niet geüpdatet wordt. Daar ook gedachten over?
Titel: Re: Packages opstarten via command line
Bericht door: Birdy op 08 februari 2020, 17:47:27
Ik heb het even getest met de standaard package "Text Editor":

Package staat op Stopped: --enable > Package staat nog steeds op Stopped maar Package werkt wel > Fout
Package staat op Stopped: --start > Package staat op Running > Goed
Package staat op Stopped: --restart Package staat nog steeds op Stopped en Package werkt niet > Goed

Package staat op Running: --disable > Package staat op Stopped > Goed
Package staat op Running: --stop > Package staat op Stopped > Goed
Package staat op Running: --restart > Package staat op Running > Goed

Trek je conclusie. ;)
Titel: Re: Packages opstarten via command line
Bericht door: Briolet op 08 februari 2020, 17:54:41
Waarschijnlijk roept de package manager deze routine ook aan en update zijn status als het gelukt is. Als je de routine rechtstreeks aanroept, heeft package manager er geen weet van en vertrouwd op zijn database.

In elk package zelf staat ook een "start-stop-status' script dat specifiek per package aangepast is. Misschien moet die aangeroepen worden?
Titel: Re: Packages opstarten via command line
Bericht door: Birdy op 08 februari 2020, 18:01:20
Alles werkt toch gewoon goed, behalve --enable
Alleen bij Monit niet en --enable is op zich een rare functie.
Titel: Re: Packages opstarten via command line
Bericht door: mc_ op 09 februari 2020, 15:54:14
Dank allen. Ik draai 'm nu met start en stop en dat werkt goed.
Titel: Re: Packages opstarten via command line
Bericht door: Birdy op 09 februari 2020, 16:40:32
 :thumbup:
Titel: Re: Packages opstarten via command line
Bericht door: Pippin op 09 februari 2020, 18:25:06
Is enable/disable niet voor autoboot en start/stop gewoon start/stop?

Net als met systemd...
Titel: Re: Packages opstarten via command line
Bericht door: mc_ op 09 februari 2020, 19:34:57
Zou kunnen. Maar start/stop staan niet in de synoservice help...

        --help                                                  Show this help
        --help-dev                                              More specialty functions for deveplopment
        --is-enabled            [ServiceName]                   Check if the service is enabled
        --status                [ServiceName]                   Get the status of specified services
        --enable                [ServiceName]                   Set runkey to yes and start the service (alias to --start)
        --disable               [ServiceName]                   Set runkey to no and stop the service (alias to --stop)
        --hard-enable           [ServiceName]                   Set runkey to yes and start the service and its dependency (alias to --hard-start)
        --hard-disable          [ServiceName]                   Set runkey to no and stop the service and its dependency (alias to --hard-stop)
        --restart               [ServiceName]                   Restart the given service
        --reload                [ServiceName]                   Reload the given service
        --pause                 [ServiceName]                   Pause the given service
        --resume                [ServiceName]                   Resume the given service
        --pause-by-reason       [ServiceName]   [Reason]        Pause the service by given reason
        --resume-by-reason      [ServiceName]   [Reason]        Resume the service by given reason
        --pause-all             (-p)    [Reason]        (Event) Pause all service by given reason with optional event(use -p to include packages)
        --pause-all-no-action   (-p)    [Reason]        (Event) Set all service runkey to no but leave the current service status(use -p to include packages)
        --resume-all            (-p)    [Reason]                Resume all service by given reason(use -p to include packages)
        --reload-by-type        [type]          (buffer)        Reload services with specified type
        --restart-by-type       [type]          (buffer)        Restart services with specified type
                                                                Type may be {file_protocol|application}
                                                                Sleep $buffer seconds before exec the command (default is 0)
Titel: Re: Packages opstarten via command line
Bericht door: Briolet op 09 februari 2020, 22:24:01
Citaat
Maar start/stop staan niet in de synoservice help...

In zekere zin wel want er staat:

--enable   … (alias to --start)
--disable  …  (alias to --stop)

Maar een alias is identiek aan het origineel dus staat het fout in de help.
Titel: Re: Packages opstarten via command line
Bericht door: sciurius op 10 februari 2020, 10:02:51
Ik gebruik synopkgctl. Bv.

synopkg start nextcloud

start Nextcloud en hij is dan ook running in het package center.