• If you need help or want to discuss things, you now can also join us on our Discord Server!
  • A first preview of the unlimited version of SinusBot can be found in the Upcoming Changes thread. A version for Windows will follow, but we don't have a release date, yet.

Bot doesn't start at boot

kil1mple

Member
Hello,
my Bot doesnt start at the system startup. I use a systemd script. The script works fine.

Status after boot.
Code:
nicoxxx@:~$ sudo systemctl status sinusbot.service
[sudo] Passwort für nico:
● sinusbot.service - Sinusbot, the Teamspeak 3 and Discord music bot.
   Loaded: loaded (/etc/systemd/system/sinusbot.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Fri 2018-11-02 18:44:26 CET; 22s ago
  Process: 880 ExecStopPost=/bin/rm -f /tmp/.sinusbot.lock (code=exited, status=0/SUCCESS)
  Process: 569 ExecStart=/opt/sinusbot/sinusbot (code=exited, status=255)
  Process: 560 ExecStartPre=/bin/rm -f /tmp/.sinusbot.lock (code=exited, status=0/SUCCESS)
 Main PID: 569 (code=exited, status=255)

Nov 02 18:44:26 xxx sinusbot[569]: (C) 2013-2018 Michael Friese. All rights reserved.
Nov 02 18:44:26 xxx sinusbot[569]: 2018/11/02 18:44:26 [GENERAL/SCRIPTS] INFO   Loading ScriptPlugin Advanced_Display_Playback_Information.js
Nov 02 18:44:26 xxx sinusbot[569]: 2018/11/02 18:44:26 [GENERAL/SCRIPTS] INFO   Loading ScriptPlugin Digital_Clock.js
Nov 02 18:44:26 xxx sinusbot[569]: 2018/11/02 18:44:26 [GENERAL/SCRIPTS] INFO   Loading ScriptPlugin NowPlaying.js
Nov 02 18:44:26 xxx sinusbot[569]: 2018/11/02 18:44:26 [GENERAL/SCRIPTS] INFO   Loading ScriptPlugin Steam_Server_Information.js
Nov 02 18:44:26 xxx sinusbot[569]: 2018/11/02 18:44:26 [GENERAL/SCRIPTS] INFO   Loading ScriptPlugin Weather_Information.js
Nov 02 18:44:26 xxx sinusbot[569]: could not contact update server
Nov 02 18:44:26 xxx systemd[1]: sinusbot.service: Main process exited, code=exited, status=255/n/a
Nov 02 18:44:26 xxx systemd[1]: sinusbot.service: Unit entered failed state.
Nov 02 18:44:26 xxx systemd[1]: sinusbot.service: Failed with result 'exit-code'.

Can you help me ? Thanks :)
 

irgendwr

no longer active, "retired" staff member
is awesome!
V.I.P.
is uber awesome!
Contributor
Insider
Are you able start the bot afterwards?
If yes: send me the content of the startscript.
If not: do what Everlike posted
 

kil1mple

Member
Yes I'm able to start the bot afterwards.
Bash:
[Unit]
Description=Sinusbot, the Teamspeak 3 and Discord music bot.
Wants=network-online.target
After=syslog.target network.target network-online.target

[Service]
User=sinusbot
ExecStartPre=/bin/rm -f /tmp/.sinusbot.lock
ExecStopPost=/bin/rm -f /tmp/.sinusbot.lock
ExecStart=/opt/sinusbot/sinusbot
WorkingDirectory=/opt/sinusbot
Type=simple
KillSignal=2
SendSIGKILL=yes
Environment=QT_XCB_GL_INTEGRATION=none
LimitNOFILE=512000
LimitNPROC=512000

[Install]
WantedBy=multi-user.target
 

irgendwr

no longer active, "retired" staff member
is awesome!
V.I.P.
is uber awesome!
Contributor
Insider
Yes I'm able to start the bot afterwards.
Bash:
[Unit]
Description=Sinusbot, the Teamspeak 3 and Discord music bot.
Wants=network-online.target
After=syslog.target network.target network-online.target

[Service]
User=sinusbot
ExecStartPre=/bin/rm -f /tmp/.sinusbot.lock
ExecStopPost=/bin/rm -f /tmp/.sinusbot.lock
ExecStart=/opt/sinusbot/sinusbot
WorkingDirectory=/opt/sinusbot
Type=simple
KillSignal=2
SendSIGKILL=yes
Environment=QT_XCB_GL_INTEGRATION=none
LimitNOFILE=512000
LimitNPROC=512000

[Install]
WantedBy=multi-user.target
Did you copy this from your server or from the wiki?
Because
Code:
Wants=network-online.target
After=syslog.target network.target network-online.target
should fix the issue since it waits until the network is up before starting the bot.
 

kil1mple

Member
It is from my server (/etc/systemd/system/sinusbot.service).
Output from curl -v https://update01.sinusbot.com

Code:
* Rebuilt URL to: https://update01.sinusbot.com/
*   Trying 104.28.14.74...
* TCP_NODELAY set
* Connected to update01.sinusbot.com (104.28.14.74) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH
* successfully set certificate verify locations:
*   CAfile: /etc/ssl/certs/ca-certificates.crt
  CApath: /etc/ssl/certs
* TLSv1.2 (OUT), TLS header, Certificate Status (22):
* TLSv1.2 (OUT), TLS handshake, Client hello (1):
* TLSv1.2 (IN), TLS handshake, Server hello (2):
* TLSv1.2 (IN), TLS handshake, Certificate (11):
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
* TLSv1.2 (IN), TLS handshake, Server finished (14):
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
* TLSv1.2 (OUT), TLS change cipher, Client hello (1):
* TLSv1.2 (OUT), TLS handshake, Finished (20):
* TLSv1.2 (IN), TLS change cipher, Client hello (1):
* TLSv1.2 (IN), TLS handshake, Finished (20):
* SSL connection using TLSv1.2 / ECDHE-ECDSA-AES128-GCM-SHA256
* ALPN, server accepted to use h2
* Server certificate:
*  subject: OU=Domain Control Validated; OU=PositiveSSL Multi-Domain; CN=sni104088.cloudflaressl.com
*  start date: Oct 13 00:00:00 2018 GMT
*  expire date: Apr 21 23:59:59 2019 GMT
*  subjectAltName: host "update01.sinusbot.com" matched cert's "*.sinusbot.com"
*  issuer: C=GB; ST=Greater Manchester; L=Salford; O=COMODO CA Limited; CN=COMODO ECC Domain Validation Secure Server CA 2
*  SSL certificate verify ok.
* Using HTTP2, server supports multi-use
* Connection state changed (HTTP/2 confirmed)
* Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0
* Using Stream ID: 1 (easy handle 0x564d6035bce0)
> GET / HTTP/1.1
> Host: update01.sinusbot.com
> User-Agent: curl/7.52.1
> Accept: */*
>
* Connection state changed (MAX_CONCURRENT_STREAMS updated)!
< HTTP/2 404
< date: Fri, 02 Nov 2018 18:40:07 GMT
< content-type: text/plain
< content-length: 0
< set-cookie: __cfduid=d35032cdd9c1757e6dcd12047565a19671541184007; expires=Sat, 02-Nov-19 18:40:07 GMT; path=/; domain=.sinusbot.com; HttpOnly
< expect-ct: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
< server: cloudflare
< cf-ray: 4738ba511ad8c4ab-DUS
<
* Curl_http_done: called premature == 0
* Connection #0 to host update01.sinusbot.com left intact
 
Top