如果在Tsclient 找不到 VNC 可用,記得先裝一下下面的軟體.
1 |
sudo apt-get install xtightvncviewer |
如果在Tsclient 找不到 VNC 可用,記得先裝一下下面的軟體.
1 |
sudo apt-get install xtightvncviewer |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
#!/usr/bin/env python #-*- coding: utf-8 -*- ''' ============================================ LOG Date:2009/09/24 Add Threading Process Date:2009/11/10 Add Check PATH, if you forget enter '/' ============================================ ''' import threading import Queue import os import sys import time __author__ = "AllenWang" __copyright__ = "Copyright 2009, SVN Backup Script" __credits__ = "Allen Wang" __license__ = "GPL" __version__ = "1.0" __maintainer__ = "Allen Wang" __email__ = "allencswang@gmail.com" __status__ = "Released" queue = Queue.Queue() def chkpath(_chk): i = len(_chk) -1 if _chk[i] in '/': pass else: _chk = _chk + '/' return _chk def Processlet(): while True: _exc = queue.get() print 'Processing: ' + _exc + "\n" os.system(_exc) queue.task_done() def svnbk(day, _backuplist, _backupdir): for i in range(len(_backuplist)): _svnpath = _svndir+_backuplist[i] _exc = '/usr/local/bin/svnadmin dump -q '+ _svnpath + ' | gzip -9>' + _backupdir + day + 'svn' +'_'+ _backuplist[i] + '.gz' queue.put(_exc) queue.join() def svn(_svndir, _backupdir): for i in range(2): t = threading.Thread(target=Processlet) t.setDaemon(True) t.start() day = time.strftime("%m%d%Y",time.localtime()) _backuplist = os.listdir(chkpath(_svndir)) svnbk(day, _backuplist, chkpath(_svndir), chkpath(_backupdir)) def main(): svn(_svndir, _backupdir) if __name__ == '__main__': try: _svndir = sys.argv[1] _backupdir = sys.argv[2] main() except: print 'Usage: Backup_SVN.py [SVN Folder] [Backup Folder]' |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
#!/usr/bin/env python #-*- coding: utf-8 -*- from subprocess import call import sys import time import commands source = "xxx@10.181.59.137:~/sysbackup/" target = "~/sysbackup/relay/" rsync = "/usr/local/bin/rsync" arguments = "-avuzb --delete -e" ssh = "'ssh -i /home/xxx/.ssh/id_dsa'" cmd = "%s %s %s %s %s" % (rsync, arguments, ssh, source, target) def sync(): while True: ret = call(cmd, shell=True) if ret !=0: print "resubmitting rsync" time.sleep(30) else: print "rsync was succesful" sys.exit(0) sync() |
只是為了偷懶,所以隨手寫了一個script…
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
#!/usr/bin/env python #-*- coding: utf-8 -*- import os import commands def usbdisk(): S_usb = commands.getoutput('df |grep /mnt/bkusb') if '/mnt/bkusb' in S_usb: print 'usb disk relly to use' return True else: if os.path.exists('/dev/da0s1'): S_Musb = commands.getoutput('sudo mount_ntfs /dev/da0s1 /mnt/bkusb/') print 'mounted usb disk' if 'Input/output error' in S_Musb: print 'mount fail' return Fail # return True if __name__ == '__main__': try: usbdisk() except: pass |