Tag Archive: shutdown

Jan 06

Python: Perintah Shutdown

Mengirim perintah shutdown dapat dilakukan melalui script Python berikut: import time import subprocess command = "/usr/bin/sudo -S /sbin/shutdown -P now" pword = "111111" proc = subprocess.Popen(command.split(), stdin = subprocess.PIPE, stdout = subprocess.PIPE) proc.communicate(pword+'\n')