Skip to content

How to use shutdowns

seriousm4x edited this page Apr 1, 2026 · 8 revisions

Shutdown consists of two fields: Shutdown Cron and Shutdown Cmd.

upsnap-shutdown

  • Shutdown command is the shell command which is triggered by cron which is ran inside the container (if you use Docker) or on your host (if you use the binary). This command will be executed when you click the green power button on the homepage to shutdown your device. {{ DEVICE_IP }} and {{ DEVICE_MAC }} can be used for automatic substitution for actual IP and MAC addresses.

  • Shutdown Cron is a common cron expression when to trigger the shutdown command. You can easily create your expression at crontab.guru. This can either be enabled or disabled with the toggle to the right.

Testing the command

To test the shutdown command you can exec into your container with docker exec -it upsnap sh, then run your command. Default packages to use are sshpass to shutdown Linux computers or net rpc to shutdown Windows computers.

Adding custom Alpine packages to the container

If you need additional packages to shutdown computers that do not ship by default with the Docker image, you can build your own custom image with a Dockerfile as such:

FROM seriousm4x/upsnap:latest
RUN apk update && \
    apk add --no-cache <YOUR_PACKAGE> && \
    rm -rf /var/cache/apk/*

Then build it:

docker build . --tag upsnap:custom

...And use that image instead when starting your Docker container.

Examples

Example 1

Shutdown computer at 04:05.

  • Cron set to 5 4 * * *
  • Cmd set to net rpc shutdown -I 192.168.1.13 -U "user%password"

Example 2

Shutdown computer at 22:00 on every day-of-week from Monday through Friday.

  • Cron set to 0 22 * * 1-5
  • Cmd set to sshpass -p your_password ssh -o "StrictHostKeyChecking=no" user@hostname "sudo poweroff"

Example 3

Shutdown computer at 00:00 every day.

  • Cron set to @daily
  • Cmd set to sshpass -p password1234 ssh -o "StrictHostKeyChecking=no" [email protected] "sudo poweroff"

Clone this wiki locally