Skip to content

Instantly share code, notes, and snippets.

@r4rohan
Last active July 18, 2020 13:01
Show Gist options
  • Save r4rohan/6d47c829d5e386dfbe99808f65eab9fc to your computer and use it in GitHub Desktop.
Save r4rohan/6d47c829d5e386dfbe99808f65eab9fc to your computer and use it in GitHub Desktop.
#!/bin/bash
# Listener to be run by root. When user from Cloud Build touches $FILE, root removes it
# and restarts the service from within the VM.
FILE="/home/rohandash1998/test"
function listen()
{
if [ -f "$FILE" ]; then
rm $FILE
sudo systemctl restart apache2
sleep 60
else
sleep 10
fi
}
while true
do
listen
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment