aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFilipp Lepalaan <f@0x00.co>2012-12-28 13:44:12 +0200
committerFilipp Lepalaan <f@0x00.co>2012-12-28 13:44:12 +0200
commitb5e50f8a4c798a444c7b619e37f8f564f3f768d4 (patch)
tree12bae4debdb4c02ce81bb6dbf98e5e6bec34202e
parentdc0ca4dd8d03b04f2c97e6761e4fee7722c455ff (diff)
downloadsimpleton-b5e50f8a4c798a444c7b619e37f8f564f3f768d4.tar.gz
simpleton-b5e50f8a4c798a444c7b619e37f8f564f3f768d4.tar.bz2
simpleton-b5e50f8a4c798a444c7b619e37f8f564f3f768d4.zip
Added AFP mount test
-rw-r--r--README.md23
-rwxr-xr-xsimpleton.py18
2 files changed, 29 insertions, 12 deletions
diff --git a/README.md b/README.md
index 475d5ab..187189d 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,7 @@
simpleton
=========
-A simple tool to check that your services are up. About as braindead as it gets, but better than nothing. ;-)
+A simple tool to check that your services are up. About as braindead as it gets, but hopefully better than nothing. ;-)
Installation
@@ -21,6 +21,9 @@ Installation
FTP:
- files.example.com
+ AFP:
+ - username:password@files.example.com/share
+
Todo
====
- Add more protocol support, even simple socket connections would be good
@@ -29,16 +32,16 @@ Todo
License
=======
- DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
- Version 2, December 2004
+ DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
+ Version 2, December 2004
- Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
+ Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
- Everyone is permitted to copy and distribute verbatim or modified
- copies of this license document, and changing it is allowed as long
- as the name is changed.
+ Everyone is permitted to copy and distribute verbatim or modified
+ copies of this license document, and changing it is allowed as long
+ as the name is changed.
- DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+ DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
- 0. You just DO WHAT THE FUCK YOU WANT TO.
+ 0. You just DO WHAT THE FUCK YOU WANT TO.
diff --git a/simpleton.py b/simpleton.py
index b7dab89..a025749 100755
--- a/simpleton.py
+++ b/simpleton.py
@@ -6,8 +6,15 @@
# To Public License, Version 2, as published by Sam Hocevar. See
# http://sam.zoy.org/wtfpl/COPYING for more details.
-import time, os, sys
-import urllib, ftplib, smtplib, yaml
+import time
+import os
+import sys
+import urllib
+import ftplib
+import smtplib
+import yaml
+import subprocess
+import tempfile
from termcolor import colored, cprint
if len(sys.argv) < 2 or not os.path.exists(sys.argv[1]):
@@ -28,8 +35,15 @@ for k, v in services.items():
ftplib.FTP(u)
if k == 'SMTP':
smtplib.SMTP(u)
+ if k == 'AFP':
+ tmp_path = tempfile.mkdtemp()
+ subprocess.check_call(['/sbin/mount_afp', '-o', 'nobrowse', u, tmp_path])
+ subprocess.check_call(['/sbin/umount', tmp_path])
+ os.rmdir(tmp_path)
+
passed += 1
except Exception, e:
+ print e
out = colored(msg, 'red')
print out