Skip to content

Instantly share code, notes, and snippets.

@hardware
Last active August 29, 2015 14:08
Show Gist options
  • Save hardware/4224dae971e0d4672cb3 to your computer and use it in GitHub Desktop.
Save hardware/4224dae971e0d4672cb3 to your computer and use it in GitHub Desktop.
#!/bin/bash
CSI="\033["
CEND="${CSI}0m"
CGREEN="${CSI}1;32m"
CRED="${CSI}1;31m"
RTORRENT_PID=$(netstat -tlnp | awk '/:45000 */ {split($NF,a,"/"); print a[1]}')
# Vérification du fonctionnement de RTorrent
if [[ $RTORRENT_PID -gt 0 ]]; then
echo -e "${CGREEN}[OK]${CEND} RTorrent est actuellement en service"
else
echo -e "${CRED}[KO]${CEND} RTorrent n'est pas en service, démarrage imminent..."
/usr/sbin/service <username>-rtorrent start
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment