Skip to content

Instantly share code, notes, and snippets.

@datherra
Last active August 29, 2015 13:56
Show Gist options
  • Save datherra/8918877 to your computer and use it in GitHub Desktop.
Save datherra/8918877 to your computer and use it in GitHub Desktop.
#!/bin/bash
mkdir -p trash
LOG=trash/$$_my_script.log
echo "Started" >> $LOG
echo "Find my log file investigating my source ;)"
sleep 120
# tip: -neq means "not equal to"
which apt-get
if [ $? -eq 0 ]; then
sudo apt-get install dstat >> $LOG
else
echo "not a debian based distro" >> $LOG
fi
# tip: -eq means "equal to"
which yum
if [ $? -eq 0 ]; then
sudo yum install -y dstat && echo "dstat installed" >> $LOG
else
echo "ERROR. Check log file" >> $LOG
fi
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment