A small feature that prevents users from using RM
#!/usr/local/bin/python3# coding:utf-8# Create your views here.# =================================================== =# author:chang-email:[email protected]# last modified:2017-06-20# filename:linuxsafe.py# description:linux SAF E js, base# blog:http://www.cnblogs.com/changbo# ==================================================== "" "1, Initialize user environment alias rm= ' mv--verbose-f--backup=numbered--target-directory/tmp/trash ' "" "Import Osimport Shutilimport Subprocessdef Trash (): If not os.path.exists ('/tmp/trash '): Os.mkdir ('/tmp/trash ') os.chmod ('/tmp/trash '), 3) else:shutil.rmtree ('/tmp/trash ') os.mkdir ('/tmp/trash ') os.chmod ('/tmp/trash ', 3) if __name__ = = ' __main__ ': commond1 = "Cd/data/homelogs && find-not-name ' *.tar.gz ' |xargs mv-f--backup=numbered-t/t Mp/trash/2>/dev/null "Commond2 =" cd/data/tradelogs && find-not-name ' *.tar.gz ' |xargs mv-f--backup=n Umbered-t/tmp/trash/2>/dev/null "subprocess.caLL (Commond1, shell=true) Subprocess.call (Commond2, shell=true) trash ()
end!
Linux Recycle Bin