Cloudron makes it easy to run web apps like WordPress, Nextcloud, GitLab on your server. Find out more or install now.


Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Bookmarks
  • Search
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo

Cloudron Forum

Apps - Status | Demo | Docs | Install
  1. Cloudron Forum
  2. Feature Requests
  3. Automated server reboot

Automated server reboot

Scheduled Pinned Locked Moved Feature Requests
feature-request
40 Posts 9 Posters 10.2k Views 9 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • girishG girish

    Also, maybe someone else can try the above too 🙂 Just to be sure I am not missing something obvious.

    fbartelsF Offline
    fbartelsF Offline
    fbartels
    App Dev
    wrote on last edited by
    #29

    @girish I can confirm that the following works for me:

    swaks -s `docker inspect --format '{{ .NetworkSettings.Networks.cloudron.IPAddress }}' mail` -p 2525 --au no-reply@9wd.eu --ap `docker inspect --format '{{ .Config.Env }}' mail | tr ' ' '\n' | grep CLOUDRON_RELAY_TOKEN | sed 's/^.*=//'` -f no-reply@9wd.eu -t 'test@9wd.eu' --h-Subject "Test mail"
    
    potemkin_aiP 1 Reply Last reply
    1
    • fbartelsF fbartels

      @girish I can confirm that the following works for me:

      swaks -s `docker inspect --format '{{ .NetworkSettings.Networks.cloudron.IPAddress }}' mail` -p 2525 --au no-reply@9wd.eu --ap `docker inspect --format '{{ .Config.Env }}' mail | tr ' ' '\n' | grep CLOUDRON_RELAY_TOKEN | sed 's/^.*=//'` -f no-reply@9wd.eu -t 'test@9wd.eu' --h-Subject "Test mail"
      
      potemkin_aiP Offline
      potemkin_aiP Offline
      potemkin_ai
      wrote on last edited by
      #30

      @fbartels @girish something is wrong here..

      Note that it has to be no-reply@yourdomain.com for both the --au argument and the -f argument.

      --au no-reply@9wd.eu ... -f no-reply@9wd.eu

      those two contradicts to each other...

      @fbartels does this command actually deliver an e-mail to test@9wd.eu?

      fbartelsF 1 Reply Last reply
      0
      • girishG girish

        @potemkin_ai We can try it step by step:

        docker inspect --format '{{ .Config.Env }}' mail | tr ' ' '\n' | grep CLOUDRON_RELAY_TOKEN
        CLOUDRON_RELAY_TOKEN=71df0df31cb3512bfe8fad02561cda813c6db4f94d2cb7137bbc162e9c1775058887606e5c37b8013df08498e3c609f52f1147cbb5a9ad96b7f4c5e848a235c44569510c37ab25eaaa67d50641481843cad93c7221893a869e34411d3e8edf6f55e3b7d8fa3ab1ce7632e0fd3bf65a8050549fe4d43d50e3ddb1c2c6b0eaca0d
        root@upgrade-test:~# echo "71df0df31cb3512bfe8fad02561cda813c6db4f94d2cb7137bbc162e9c1775058887606e5c37b8013df08498e3c609f52f1147cbb5a9ad96b7f4c5e848a235c44569510c37ab25eaaa67d50641481843cad93c7221893a869e34411d3e8edf6f55e3b7d8fa3ab1ce7632e0fd3bf65a8050549fe4d43d50e3ddb1c2c6b0eaca0d" | wc -c
        257
        

        So, mine is also 257 characters long.

        # docker inspect --format '{{ .NetworkSettings.Networks.cloudron.IPAddress }}' mail
        172.18.0.3
        

        The final command:

        # swaks -s 172.18.0.3 -p 2525 --au no-reply@cloudron.space --ap "71df0df31cb3512bfe8fad02561cda813c6db4f94d2cb7137bbc162e9c1775058887606e5c37b8013df08498e3c609f52f1147cbb5a9ad96b7f4c5e848a235c44569510c37ab25eaaa67d50641481843cad93c7221893a869e34411d3e8edf6f55e3b7d8fa3ab1ce7632e0fd3bf65a8050549fe4d43d50e3ddb1c2c6b0eaca0d" -f no-reply@cloudron.space -t 'test@cloudron.io' --h-Subject "Test mail"
        

        Can you paste your entire sequence like above? Note that it has to be no-reply@yourdomain.com for both the --au argument and the -f argument.

        potemkin_aiP Offline
        potemkin_aiP Offline
        potemkin_ai
        wrote on last edited by
        #31

        @girish sure, here it is:

        root@anabelle:~# docker inspect --format '{{ .Config.Env }}' mail | tr ' ' '\n' | grep CLOUDRON_RELAY_TOKEN
        CLOUDRON_RELAY_TOKEN=818e705168cd0605a63ee69228bdcdec7def1d170054c14281f27c3b986486adcdd447bf161f1f6b4eb858037abc19558cf8877bc1603c4a152db20c94aa9dd7eabb68a9da950b8e54684fcb75a531c808254c0a60165f20a825170b24b1b06bb833955750412d769257a3607cc5637e40dca57402be4ef67a1d4f91df329c22
        root@anabelle:~# echo "818e705168cd0605a63ee69228bdcdec7def1d170054c14281f27c3b986486adcdd447bf161f1f6b4eb858037abc19558cf8877bc1603c4a152db20c94aa9dd7eabb68a9da950b8e54684fcb75a531c808254c0a60165f20a825170b24b1b06bb833955750412d769257a3607cc5637e40dca57402be4ef67a1d4f91df329c22" | wc -c
        257
        root@anabelle:~# docker inspect --format '{{ .NetworkSettings.Networks.cloudron.IPAddress }}' mail
        172.18.0.5
        
        root@anabelle:~# swaks -s 172.18.0.5 -p 2525 --au no-reply@cloudron.space --ap "818e705168cd0605a63ee69228bdcdec7def1d170054c14281f27c3b986486adcdd447bf161f1f6b4eb858037abc19558cf8877bc1603c4a152db20c94aa9dd7eabb68a9da950b8e54684fcb75a531c808254c0a60165f20a825170b24b1b06bb833955750412d769257a3607cc5637e40dca57402be4ef67a1d4f91df329c22" -f no-reply@cloudron.space -t 'mypersonal@email.com' --h-Subject "Test mail"
        === Trying 172.18.0.5:2525...
        === Connected to 172.18.0.5.
        <-  220 my.serveddomain.com ESMTP Haraka/2.8.27 ready
         -> EHLO localhost
        <-  250-my.serveddomain.com Hello [172.18.0.1]Haraka is at your service.
        <-  250-PIPELINING
        <-  250-8BITMIME
        <-  250-SMTPUTF8
        <-  250-SIZE 26214400
        <-  250 AUTH LOGIN PLAIN
         -> AUTH LOGIN
        <-  334 VXNlcm5hbWU6
         -> bm8tcmVwbHlAY2xvdWRyb24uc3BhY2U=
        <-  334 UGFzc3dvcmQ6
         -> ODE4ZTcwNTE2OGNkYTYwMTY1ZjIwYTgyNTE3MGIyM2IxYjA2YmI4MzM5NTU3NTA0MTQwMmJlNGVmNjdhMWQ0ZjkxZGYyZDc2OTI1N2EzNjA3Y2M1NjM3ZTQwZGNhNTc4YmRjZGVjN2RlZjFkMTcwMDUyMjU1OGNmODg3N2JjMTYwMmM0YTE1MmNiMjljOTRhYTlkZDdlYTRjMTQyODFmMjdjM2I5ODY0ODZhZDA2MDVhNjNlZTY5YmI2OGE5ZGE5NTBiOGU1NDU4NGVjYjc1YTUzMGM4MDgyNTRjMGNkZDQ0N2JmMTYxZjFmNmI0ZWI4NTgwMzdhYmMxODMyOWMyMg==
        <** 535 5.7.8 Authentication failed
         -> AUTH PLAIN AG5vLXJlcGx5QGNsb3Vkcm9uLnNwYWNlADgxOGU3MDUxNjhjZGE2MDE2NWYyMGE4MjUxNzBiMjNiMWIwNmJiODMzOTU1NzUwNDE0MDJiZTRlZjY3YTFkNGY5MWRmMmQ3NjkyNTdhMzYwN2NjNTYzN2U0MGRjYTU3OGJkY2RlYzdkZWYxZDE3MDA1MjI1NThjZjg4NzdiYzE2MDJjNGExNTJjYjI5Yzk0YWE5ZGQ3ZWE0YzE0MjgxZjI3YzNiOTg2NDg2YWQwNjA1YTYzZWU2OWJiNjhhOWRhOTUwYjhlNTQ1ODRlY2I3NWE1MzBjODA4MjU0YzBjZGQ0NDdiZjE2MWYxZjZiNGViODU4MDM3YWJjMTgzMjljMjI=
        <** 535 5.7.8 Authentication failed
        *** No authentication type succeeded
         -> QUIT
        <-  221 my.serveddomain.com closing connection. Have a jolly good day.
        === Connection closed with remote host.
        
        girishG 1 Reply Last reply
        0
        • potemkin_aiP potemkin_ai

          @girish sure, here it is:

          root@anabelle:~# docker inspect --format '{{ .Config.Env }}' mail | tr ' ' '\n' | grep CLOUDRON_RELAY_TOKEN
          CLOUDRON_RELAY_TOKEN=818e705168cd0605a63ee69228bdcdec7def1d170054c14281f27c3b986486adcdd447bf161f1f6b4eb858037abc19558cf8877bc1603c4a152db20c94aa9dd7eabb68a9da950b8e54684fcb75a531c808254c0a60165f20a825170b24b1b06bb833955750412d769257a3607cc5637e40dca57402be4ef67a1d4f91df329c22
          root@anabelle:~# echo "818e705168cd0605a63ee69228bdcdec7def1d170054c14281f27c3b986486adcdd447bf161f1f6b4eb858037abc19558cf8877bc1603c4a152db20c94aa9dd7eabb68a9da950b8e54684fcb75a531c808254c0a60165f20a825170b24b1b06bb833955750412d769257a3607cc5637e40dca57402be4ef67a1d4f91df329c22" | wc -c
          257
          root@anabelle:~# docker inspect --format '{{ .NetworkSettings.Networks.cloudron.IPAddress }}' mail
          172.18.0.5
          
          root@anabelle:~# swaks -s 172.18.0.5 -p 2525 --au no-reply@cloudron.space --ap "818e705168cd0605a63ee69228bdcdec7def1d170054c14281f27c3b986486adcdd447bf161f1f6b4eb858037abc19558cf8877bc1603c4a152db20c94aa9dd7eabb68a9da950b8e54684fcb75a531c808254c0a60165f20a825170b24b1b06bb833955750412d769257a3607cc5637e40dca57402be4ef67a1d4f91df329c22" -f no-reply@cloudron.space -t 'mypersonal@email.com' --h-Subject "Test mail"
          === Trying 172.18.0.5:2525...
          === Connected to 172.18.0.5.
          <-  220 my.serveddomain.com ESMTP Haraka/2.8.27 ready
           -> EHLO localhost
          <-  250-my.serveddomain.com Hello [172.18.0.1]Haraka is at your service.
          <-  250-PIPELINING
          <-  250-8BITMIME
          <-  250-SMTPUTF8
          <-  250-SIZE 26214400
          <-  250 AUTH LOGIN PLAIN
           -> AUTH LOGIN
          <-  334 VXNlcm5hbWU6
           -> bm8tcmVwbHlAY2xvdWRyb24uc3BhY2U=
          <-  334 UGFzc3dvcmQ6
           -> ODE4ZTcwNTE2OGNkYTYwMTY1ZjIwYTgyNTE3MGIyM2IxYjA2YmI4MzM5NTU3NTA0MTQwMmJlNGVmNjdhMWQ0ZjkxZGYyZDc2OTI1N2EzNjA3Y2M1NjM3ZTQwZGNhNTc4YmRjZGVjN2RlZjFkMTcwMDUyMjU1OGNmODg3N2JjMTYwMmM0YTE1MmNiMjljOTRhYTlkZDdlYTRjMTQyODFmMjdjM2I5ODY0ODZhZDA2MDVhNjNlZTY5YmI2OGE5ZGE5NTBiOGU1NDU4NGVjYjc1YTUzMGM4MDgyNTRjMGNkZDQ0N2JmMTYxZjFmNmI0ZWI4NTgwMzdhYmMxODMyOWMyMg==
          <** 535 5.7.8 Authentication failed
           -> AUTH PLAIN AG5vLXJlcGx5QGNsb3Vkcm9uLnNwYWNlADgxOGU3MDUxNjhjZGE2MDE2NWYyMGE4MjUxNzBiMjNiMWIwNmJiODMzOTU1NzUwNDE0MDJiZTRlZjY3YTFkNGY5MWRmMmQ3NjkyNTdhMzYwN2NjNTYzN2U0MGRjYTU3OGJkY2RlYzdkZWYxZDE3MDA1MjI1NThjZjg4NzdiYzE2MDJjNGExNTJjYjI5Yzk0YWE5ZGQ3ZWE0YzE0MjgxZjI3YzNiOTg2NDg2YWQwNjA1YTYzZWU2OWJiNjhhOWRhOTUwYjhlNTQ1ODRlY2I3NWE1MzBjODA4MjU0YzBjZGQ0NDdiZjE2MWYxZjZiNGViODU4MDM3YWJjMTgzMjljMjI=
          <** 535 5.7.8 Authentication failed
          *** No authentication type succeeded
           -> QUIT
          <-  221 my.serveddomain.com closing connection. Have a jolly good day.
          === Connection closed with remote host.
          
          girishG Offline
          girishG Offline
          girish
          Staff
          wrote on last edited by
          #32

          @potemkin_ai the no-reply@cloudron.space in the swaks command is not correct. you have to replace this with no-reply@yourdashboarddomain.com (in 2 places in the command line)

          1 Reply Last reply
          1
          • potemkin_aiP potemkin_ai

            @fbartels @girish something is wrong here..

            Note that it has to be no-reply@yourdomain.com for both the --au argument and the -f argument.

            --au no-reply@9wd.eu ... -f no-reply@9wd.eu

            those two contradicts to each other...

            @fbartels does this command actually deliver an e-mail to test@9wd.eu?

            fbartelsF Offline
            fbartelsF Offline
            fbartels
            App Dev
            wrote on last edited by
            #33

            @potemkin_ai said in Automated server reboot:

            @fbartels does this command actually deliver an e-mail to test@9wd.eu?

            Yes, just like Girish said, you only need to make sure that your from (the -f parameter) and the login user (the -au parameter) match your main cloudron domain. The -t is the parameter for the recipient, this can be on the cloudron system or another mailbox.

            potemkin_aiP 1 Reply Last reply
            1
            • fbartelsF fbartels

              @potemkin_ai said in Automated server reboot:

              @fbartels does this command actually deliver an e-mail to test@9wd.eu?

              Yes, just like Girish said, you only need to make sure that your from (the -f parameter) and the login user (the -au parameter) match your main cloudron domain. The -t is the parameter for the recipient, this can be on the cloudron system or another mailbox.

              potemkin_aiP Offline
              potemkin_aiP Offline
              potemkin_ai
              wrote on last edited by
              #34

              @fbartels @girish , got it working now - thank you very much!!

              necrevistonnezrN 1 Reply Last reply
              1
              • potemkin_aiP potemkin_ai

                @fbartels @girish , got it working now - thank you very much!!

                necrevistonnezrN Offline
                necrevistonnezrN Offline
                necrevistonnezr
                wrote on last edited by necrevistonnezr
                #35

                @potemkin_ai said in Automated server reboot:

                @fbartels @girish , got it working now - thank you very much!!

                Can you share your full script? Thanks!

                potemkin_aiP 1 Reply Last reply
                2
                • necrevistonnezrN necrevistonnezr

                  @potemkin_ai said in Automated server reboot:

                  @fbartels @girish , got it working now - thank you very much!!

                  Can you share your full script? Thanks!

                  potemkin_aiP Offline
                  potemkin_aiP Offline
                  potemkin_ai
                  wrote on last edited by
                  #36

                  @necrevistonnezr sure, scripted and published:

                  • https://github.com/Potemkin-Co/quickies/blob/main/reboot_ubuntu_if_required.sh - do the server reboot, if it was requested by anything earlier, calls mail script before the reboot
                  • https://github.com/Potemkin-Co/quickies/blob/main/send_mail_with_cloudron.sh sends an e-mail

                  Be sure to change your e-mail and path to the mail script at the first script.

                  necrevistonnezrN I 2 Replies Last reply
                  4
                  • potemkin_aiP potemkin_ai

                    @necrevistonnezr sure, scripted and published:

                    • https://github.com/Potemkin-Co/quickies/blob/main/reboot_ubuntu_if_required.sh - do the server reboot, if it was requested by anything earlier, calls mail script before the reboot
                    • https://github.com/Potemkin-Co/quickies/blob/main/send_mail_with_cloudron.sh sends an e-mail

                    Be sure to change your e-mail and path to the mail script at the first script.

                    necrevistonnezrN Offline
                    necrevistonnezrN Offline
                    necrevistonnezr
                    wrote on last edited by
                    #37

                    @potemkin_ai Thanks!

                    1 Reply Last reply
                    1
                    • potemkin_aiP potemkin_ai

                      @necrevistonnezr sure, scripted and published:

                      • https://github.com/Potemkin-Co/quickies/blob/main/reboot_ubuntu_if_required.sh - do the server reboot, if it was requested by anything earlier, calls mail script before the reboot
                      • https://github.com/Potemkin-Co/quickies/blob/main/send_mail_with_cloudron.sh sends an e-mail

                      Be sure to change your e-mail and path to the mail script at the first script.

                      I Offline
                      I Offline
                      IniBudi
                      translator
                      wrote on last edited by
                      #38

                      @potemkin_ai is the script still relevant on the latest version of Cloudron?

                      1 Reply Last reply
                      1
                      • d19dotcaD Offline
                        d19dotcaD Offline
                        d19dotca
                        wrote on last edited by
                        #39

                        @girish , maybe this is a good feature for 9.1?

                        --
                        Dustin Dauncey
                        www.d19.ca

                        1 Reply Last reply
                        2
                        • potemkin_aiP Offline
                          potemkin_aiP Offline
                          potemkin_ai
                          wrote on last edited by
                          #40

                          @inibudi , it is; but I've optimized it down to a single crontab entry:

                          crontab -l
                          48 2 * * * /bin/sh -c '[ -f /var/run/reboot-required ] && sudo shutdown -r now'
                          
                          1 Reply Last reply
                          2

                          Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                          Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                          With your input, this post could be even better 💗

                          Register Login
                          Reply
                          • Reply as topic
                          Log in to reply
                          • Oldest to Newest
                          • Newest to Oldest
                          • Most Votes


                          • Login

                          • Don't have an account? Register

                          • Login or register to search.
                          • First post
                            Last post
                          0
                          • Categories
                          • Recent
                          • Tags
                          • Popular
                          • Bookmarks
                          • Search