{"id":20469102,"url":"https://github.com/ghosts6/shutdown_script","last_synced_at":"2025-03-05T13:20:26.834Z","repository":{"id":197431896,"uuid":"698641008","full_name":"Ghosts6/shutdown_script","owner":"Ghosts6","description":"some useful script with c c++ python to restart or shutdown system in different os","archived":false,"fork":false,"pushed_at":"2024-03-20T12:11:45.000Z","size":22,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-16T01:49:41.676Z","etag":null,"topics":["c","cpp","linux","python3","shutdown-script","windows"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Ghosts6.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-09-30T14:20:47.000Z","updated_at":"2024-09-14T07:57:28.000Z","dependencies_parsed_at":null,"dependency_job_id":"3d19d5dc-f94a-4261-8130-bd1abf838463","html_url":"https://github.com/Ghosts6/shutdown_script","commit_stats":null,"previous_names":["ghosts6/shutdonw_script"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ghosts6%2Fshutdown_script","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ghosts6%2Fshutdown_script/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ghosts6%2Fshutdown_script/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ghosts6%2Fshutdown_script/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Ghosts6","download_url":"https://codeload.github.com/Ghosts6/shutdown_script/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242031667,"owners_count":20060619,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["c","cpp","linux","python3","shutdown-script","windows"],"created_at":"2024-11-15T14:07:57.167Z","updated_at":"2025-03-05T13:20:26.801Z","avatar_url":"https://github.com/Ghosts6.png","language":"C","readme":"![baner](https://github.com/Ghosts6/Local-website/blob/main/img/Baner.png)\n\n#  💫Description:\nsome useful script with c c++ python to restart or shutdown system in different os\n# 📴shutdown_script:\n#python :\n\n```python\nimport os\n\ndef main():\n    choice = input(\"select operation type?(shutdown/restart)\")\n    if choice == \"shutdown\" or choice == \"shutdown\":\n        shutdown()\n    elif choice == \"restart\" or choice == \"Restart\":\n        restart()\n    else:\n        print(\"wrong choice please try again .\")\n        main()\n\ndef shutdown():\n    shutdown = input(\"do you want to shutdown system(yes/no)?\")\n    if shutdown == \"yes\" or shutdown == \"Yes\" :\n        os.system(\"shutdown /s /t 1\") \n        os.system(\"sudo poweroff\")\n        os.system(\"shutdown now -h\")\n    elif shutdown == \"no\":\n        exit()\n\n\ndef restart():\n    restart = input(\"do you want restart system(yes/no)\")\n    if restart == \"yes\"  or restart == \"Yes\" :\n        os.system(\"sudo reboot\")\n        os.system(\"shutdown /r\")\n        os.system(\"shutdown -r -t 0\")\n    elif restart == \"no\" :\n        exit()\n\nmain()\n```\n#c++:\n\n```cpp\n#include \u003ciostream\u003e\n#include \u003cstring\u003e\nusing namespace std;\nint main(){\n    char choice;\n    string choice_2;\n    cout\u003c\u003c\"do you want restart or shutdown for restart type r for shutdown type s\"\u003c\u003cendl;\n    cin\u003e\u003echoice;\n    jump:\nif(choice == 'r' || choice == 'R'){\n    system(\"shutdown -r -t 0\");\n    system(\"sudo reboot\");\n    system(\"c:\\windows\\system32\\shutdown /r \");\n}\nif(choice == 's' || choice == 'S'){\n    system(\"sudo poweroff\");\n    system(\"shutdown -P now\");\n    system(\"c:\\windows\\system32\\shutdown /i \");\n}\nelse{\n    cout\u003c\u003c\"wrong input\"\u003c\u003c'\\n'\u003c\u003c\"do you want to try again?(yes/no)\"\u003c\u003cendl;\n    cin\u003e\u003echoice_2;\n}\nif(choice_2 == \"yes\" || choice_2 == \"Yes\"){\n    goto jump;\n}\nelse{\n    cout\u003c\u003c\"end of program\"\u003c\u003cendl;\n}\n    return 0;\n}\n```\n#c:\n\n```c\n#include \u003cstdio.h\u003e\n#include \u003cstdlib.h\u003e\n#include \u003cstring.h\u003e\n\nvoid shutdown();\nvoid restart();\n\nint main() {\n    char choice[20]; \n    label:\n    printf(\"Select operation type (restart/shutdown) \\n\"); \n    scanf(\"%s\", choice); \n    if (strcmp(choice, \"restart\") == 0 || strcmp(choice, \"Restart\") == 0) {\n        restart();\n    }\n    else if (strcmp(choice, \"shutdown\") == 0 || strcmp(choice, \"Shutdown\") == 0) { \n        shutdown();\n    }\n    else {\n        printf(\"wrong choice please try again \\n\");\n        goto label;\n    }\n    printf(\"End of program\\n\");\n    return 0;\n}\n\nvoid shutdown(){\n    #ifdef _WIN32\n        system(\"shutdown /s\");\n    #elif __unix__\n        system(\"sudo poweroff\");\n    #elif __linux__\n        system(\"sudo poweroff\");\n    #endif\n}\n\nvoid restart(){\n    #ifdef _WIN32\n        system(\"shutdown /r\");\n    #elif __unix__\n        system(\"sudo reboot\");\n    #elif __linux__\n        system(\"sudo reboot\");\n    #endif\n}\n```\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fghosts6%2Fshutdown_script","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fghosts6%2Fshutdown_script","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fghosts6%2Fshutdown_script/lists"}