Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save rrichards/094944e6b7e21ae83a7e6fe5aba95d62 to your computer and use it in GitHub Desktop.

Select an option

Save rrichards/094944e6b7e21ae83a7e6fe5aba95d62 to your computer and use it in GitHub Desktop.
$ sudo nano /etc/systemd/system/startup.service
[Unit]
Description=Startup
[Service]
ExecStart=/usr/local/bin/startup.sh
[Install]
WantedBy=default.target
$ sudo nano /usr/local/bin/startup.sh
#!/bin/bash
date > /root/report.txt
du -sh /home/ >> /root/report.txt
$ sudo chmod 744 /usr/local/bin/startup.sh
$ sudo chmod 664 /etc/systemd/system/startup.service
$ systemctl daemon-reload
$ systemctl enable startup.service
# Test the script
$ systemctl start startup.service
$ cat /root/report.txt
# Reboot
$ sudo reboot
# Change password for user ubuntu
$ sudo passwd ubuntu
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment