{"id":18023600,"url":"https://github.com/jeffotoni/livewebserver","last_synced_at":"2026-04-16T04:31:50.394Z","repository":{"id":134047437,"uuid":"90537197","full_name":"jeffotoni/livewebserver","owner":"jeffotoni","description":"Script in bash, to check if the apache server is online, if it is not rebooting the service.","archived":false,"fork":false,"pushed_at":"2017-05-11T21:04:13.000Z","size":22,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-08T16:03:18.846Z","etag":null,"topics":["apache","aws","aws-ses","awscli","bash-script","script"],"latest_commit_sha":null,"homepage":"","language":"Shell","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/jeffotoni.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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-05-07T14:10:05.000Z","updated_at":"2017-05-08T02:49:48.000Z","dependencies_parsed_at":null,"dependency_job_id":"37a5384d-584a-43d1-8eac-480e3b3580bc","html_url":"https://github.com/jeffotoni/livewebserver","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/jeffotoni/livewebserver","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jeffotoni%2Flivewebserver","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jeffotoni%2Flivewebserver/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jeffotoni%2Flivewebserver/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jeffotoni%2Flivewebserver/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jeffotoni","download_url":"https://codeload.github.com/jeffotoni/livewebserver/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jeffotoni%2Flivewebserver/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31871479,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-15T15:24:51.572Z","status":"online","status_checked_at":"2026-04-16T02:00:06.042Z","response_time":69,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["apache","aws","aws-ses","awscli","bash-script","script"],"created_at":"2024-10-30T07:09:59.214Z","updated_at":"2026-04-16T04:31:50.357Z","avatar_url":"https://github.com/jeffotoni.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# livewebserver\n\nScript in bash, to check if the server apache2 and postgresql are online, if you are not restarting the services.\n\nIt sends emails to communicate if the server is not online, you can use the mail for the client to send email or aws cli, but for aws cli will have to install in your linux environment.\n\nThis script was made in bash in the ubuntu environment at first, we are checking apache2 and postgresql.\n\nSome other services that we will need to implement are redis and nginx.\n\n# Setting up some variables\n\nYou need to set up email that will receive notifications\n\n```sh\n\n#\n# Email for email submissions\n#\nFROM=\"yourmail@domain.com\"\n\n#\n# Email to\n#\nTO=\"mailto@domain.com\"\n\n```\n\nYou need to set up domains you want to test\n\n```sh\n\n#\n# Domains to test if they are online\n# Are all on the same server\n#\nDOMAIN_TEST='https://www.yourdomain1.com http://yourdomain2.com'\n\n```\n\nThere are 2 ways to send emails sendmail and sendmailaws, one is by using the mail from the aws cli package to install [mail (utils)](http://docs.aws.amazon.com/cli/latest/userguide/installing.html) to know more about aws ses [aws cli (Ses)](http://docs.aws.amazon.com/cli/latest/reference/ses/send-email.html) \n\nBy default mail is enabled\n\n```sh\n\n#\n# Shipping method mailutils\n#\nACTIVE_MAIL=\"mailutils\"\n\n#\n# Sending emails through aws cli\n# The parameters are jsons\n#\n# destination.json =\u003e {\"ToAddresses\":  [\"mailto@domain.com\"]}\n# \n# message.json =\u003e {\n# \n#   \"Subject\": {\n#       \"Data\": \"Server Apache Checking\",\n#       \"Charset\": \"UTF-8\"\n#   },\n#   \"Body\": {\n#       \"Text\": {\n#           \"Data\": \"\",\n#            \"Charset\": \"UTF-8\"\n#        },\n#        \"Html\": {\n#            \"Data\": \"\u003ch1\u003eServer stopped, initializing apache\u003c/h1\u003e\"\n#        }\n#    }\n# }\n# \n# --destination file://destination.json\n# --message file://message.json\n# \n#  OR\n#  \n#  --destination '{}'\n#  --message '{}'\n# \n\t\n#\n# Shipping method aws cli ses\n#\n#ACTIVE_MAIL=\"aws\"\n\n```\n\nDetermines which is the operating system, so that its function is appropriate as each linux distribution\n\n\n```sh\n\n#\n#\n# Determines which is the operating system \n#\nSO=\"Ubuntu\"\n\n```\n\nYou can create your own function for your favorite distribution, look at the example\n\n\n```sh\n\n#\n# Function call\n#\nDoApache$SO\n\n#\n# Function statement\n#\nDoApacheUbuntu ()\n{\n  #code\n}\n\n```\n\nYou can also create a postgresql-specific function for your distribution\n\n\n```sh\n\n#\n# Function call\n#\nDoPingPostgres\n\n#\n# Function statement\n#\nDoPingPostgres ()\n{\n  # \n  # If postgresql is not responding\n  #\n\n  # code ...\n  DoRestartPostgres$OS \"$status_lower\"\n}\n\n```\n\nDetermines the path of the apache error log\n\n\n```sh\n\n#\n# path log error apache\n#\nPATHLOG_ERROR=\"/var/log/apache2/error.log\"\n\n```\n\nDetermines the path of the Postgresql error log\n\n\n```sh\n\n#\n# path log error postgresql\n#\nPATHLOG_POSTGRE=\"/var/lib/postgresql/9.5/main/pg_log/yourlog.log\"\n\n```\n\n# running\n\n$ sh livewebserver.sh\n\n# Can be configured by cron to be called from time to time\n\nCalling the script every 1 minute\n\n```sh\n\n*/1 * * * *   cd /script/livewebserver \u0026\u0026 sh livewebserver.sh \u003e\u003e livewebserver.log\n\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjeffotoni%2Flivewebserver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjeffotoni%2Flivewebserver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjeffotoni%2Flivewebserver/lists"}