Skip to content
Extraits de code Groupes Projets
Valider a5cabf65 rédigé par Flo de QTG's avatar Flo de QTG
Parcourir les fichiers

Create a suicid script to remove the current path and kill connection

parent 5bf3b333
Aucune étiquette associée trouvée
1 requête de fusion!6Resolve "Create a suicid script to remove current folder and kill connection"
// @author: Flo de Qu'est-ce que tu GEEKes ?
// This suicid script removes scripts folder
// and kills connection
program_name = program_path.split("/")[-1]
if params.len < 1 or params[0] == "-h" or params[0] == "--help" then exit("<b>Usage: "+program_name+" [do|dry-run]</b>")
this_shell=get_shell
this_computer=this_shell.host_computer
script_folder = this_computer.File(this_computer.current_path)
if script_folder.has_permission("w") then
if "do" == params[0] then
script_folder.delete
else
print("Dry-Run mode!\n")
print("Delete folder: " + this_computer.current_path)
end if
else
print("permission denied")
end if
procs = this_computer.show_procs
procs_lines = procs.split(char(10))
for proc_line in procs_lines
proc_details = proc_line.split(" ")
if null != proc_details.indexOf("Terminal") and active_user == proc_details[proc_details.indexOf("Terminal") - 4] then
terminal_pid=proc_details[proc_details.indexOf("Terminal") - 3]
if "do" == params[0] then
print(this_computer.close_program(terminal_pid.to_int))
else
print("Kill " + terminal_pid)
end if
end if
end for
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter