Forked from toan2406/Startup script for ubuntu 16.04
Created
January 28, 2019 09:48
-
-
Save rrichards/094944e6b7e21ae83a7e6fe5aba95d62 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $ 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