Skip to content

Instantly share code, notes, and snippets.

@gdiaz384
Last active July 17, 2023 00:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gdiaz384/343e3704dc1f955e6bd904d384566cb4 to your computer and use it in GitHub Desktop.
Save gdiaz384/343e3704dc1f955e6bd904d384566cb4 to your computer and use it in GitHub Desktop.
crontab -e example
# SSH daemon
@reboot /usr/sbin/sshd -p 22
# HTTP file server
@reboot sudo /usr/bin/nodejs /usr/local/bin/http-server /home/pi/Public --no-dotfiles -p 8080
@daily sudo pkill node && sudo /usr/bin/nodejs /usr/local/bin/http-server /home/pi/Public --no-dotfiles -p 8080
# TLS proxy and authentication on port 443
@reboot /etc/init.d/stunnel4 start
@daily sudo /home/pi/stunnel/certbot-auto renew --allow-subset-of-names --standalone --rsa-key-size 4096 --preferred-challenges tls-sni-01 --no-self-upgrade --non-interactive --agree-tos --quiet --email your.email@example.invalid --pre-hook "sudo service stunnel4 stop" --post-hook "sudo service stunnel4 start"
# Alternative authentication on HTTP port 80
@daily /usr/bin/certbot renew --allow-subset-of-names --standalone --rsa-key-size 4096 --preferred-challenges http-01 --no-self-upgrade --non-interactive --quiet --agree-tos --email your.email@example.invalid
# Start seedbox software
@reboot cd /home/pi/ && /home/pi/start-qbittorrent.sh
#"/home/pi/start-qbittorrent.sh" contents:
##!/bin/sh
#cd /home/pi/
#sleep 60
##If qbittorrent is already running, do nothing. Otherwise, start it on Display0.
#[ `pgrep qbittorrent` ] && echo runningAlready || DISPLAY=:0 /usr/bin/qbittorrent &
# IRC bot
@reboot cd /home/pi/iroffer && /home/pi/iroffer/./iroffer -b /home/pi/iroffer/mybot.config
# Maintenance
@monthly sudo /sbin/shutdown -r now
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment