Created
November 2, 2016 07:51
-
-
Save toan2406/a0772fd8253f1e06a4bfea72bf37d3b0 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