5,337
edits
(→rsync) |
(→Gnome) |
||
Line 434: | Line 434: | ||
sudo apt install gnome-tweaks | sudo apt install gnome-tweaks | ||
sudo apt install chrome-gnome-shell | sudo apt install chrome-gnome-shell | ||
</pre> | |||
==Auto Reboot== | |||
[https://unix.stackexchange.com/questions/141095/automatically-reboot-if-no-wifi-connection-for-a-certain-time reference] | |||
Auto reboot if no internet is detected: | |||
<syntaxhighlight lang="bash"> | |||
#!/bin/bash | |||
TMP_FILE=/tmp/inet_up | |||
FAIL_THRESHOLD=1 | |||
# Edit this function if you want to do something besides reboot | |||
no_inet_action() { | |||
rm -f $TMP_FILE | |||
shutdown -r now 'No internet.' | |||
} | |||
increment_tmp_file() { | |||
if [ ! -f $TMP_FILE ]; then | |||
echo 0 > $TMP_FILE | |||
fi | |||
oldnum=`cut -d ',' -f2 $TMP_FILE` | |||
newnum=`expr $oldnum + 1` | |||
sed -i "s/$oldnum\$/$newnum/g" $TMP_FILE | |||
} | |||
if ping -c5 google.com; then | |||
echo 0 > $TMP_FILE | |||
else | |||
increment_tmp_file | |||
oldnum=`cut -d ',' -f2 $TMP_FILE` | |||
[ $oldnum -ge $FAIL_THRESHOLD ] && no_inet_action | |||
fi | |||
</syntaxhighlight> | |||
Add to sudo's crontab | |||
<pre> | |||
*/30 * * * * /home/david/bin/check_inet.sh | |||
</pre> | </pre> |