Skip to content

Instantly share code, notes, and snippets.

@k0nsl
Created December 18, 2013 12:11
Show Gist options
  • Select an option

  • Save k0nsl/8021280 to your computer and use it in GitHub Desktop.

Select an option

Save k0nsl/8021280 to your computer and use it in GitHub Desktop.
Output hostname and uptime (in days only). The output is used in conjunction with a cronjob and output is redirected to a HTML file.
#!/bin/bash
# uptime-bash.sh for https://k0nsl.org
uptime=$(</proc/uptime)
uptime=${uptime%%.*}
days=$(( uptime/60/60/24 ))
host=$(hostname)
echo "<small>$host up for $days days so far :)</small>"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment