Skip to content

Instantly share code, notes, and snippets.

@rastislavcore
Last active May 6, 2023 12:53
Show Gist options
  • Save rastislavcore/7b0373d1dd98e95ce59cc5d023a7160e to your computer and use it in GitHub Desktop.
Save rastislavcore/7b0373d1dd98e95ce59cc5d023a7160e to your computer and use it in GitHub Desktop.
The CoreMiner service
#!/bin/bash
echo "$(tput setaf 3)●$(tput sgr 0) We will start the script with the SUDO mode! You can stop it and proceed manually if needed."
sudo -v
echo "$(tput setaf 3)●$(tput sgr 0) Stopping the service."
systemctl stop coreverif.service
echo "$(tput setaf 3)●$(tput sgr 0) Disabling the service."
systemctl disable coreverif.service
echo "$(tput setaf 3)●$(tput sgr 0) Removing the service files."
rm /etc/systemd/system/coreverif.service
rm /usr/lib/systemd/system/coreverif.service
echo "$(tput setaf 3)●$(tput sgr 0) Reloading the daemon."
systemctl daemon-reload
echo "$(tput setaf 3)●$(tput sgr 0) Remove the failed status."
systemctl reset-failed coreverif.service
#!/bin/bash
echo "$(tput setaf 3)●$(tput sgr 0) We will start the script with the SUDO mode! You can stop it and proceed manually if needed."
sudo -v
echo "$(tput setaf 3)●$(tput sgr 0) Stopping the service."
systemctl stop coreverif.service
echo "$(tput setaf 3)●$(tput sgr 0) Disabling the service."
systemctl disable coreverif.service
echo "$(tput setaf 3)●$(tput sgr 0) Reloading the daemon."
systemctl daemon-reload
#!/bin/bash
echo "$(tput setaf 3)●$(tput sgr 0) We will start the script with the SUDO mode! You can stop it and proceed manually if needed."
sudo -v
echo "$(tput setaf 3)●$(tput sgr 0) Enabling the service."
systemctl enable coreverif.service
echo "$(tput setaf 3)●$(tput sgr 0) Starting the service."
systemctl start coreverif.service
echo "$(tput setaf 3)●$(tput sgr 0) Reloading the daemon."
systemctl daemon-reload
#!/bin/bash
echo "$(tput setaf 3)●$(tput sgr 0) We will start the script with the SUDO mode! You can stop it and proceed manually if needed."
sudo -v
echo "$(tput setaf 3)●$(tput sgr 0) Creating service file."
echo "[Unit]
Description=CoreVerificator
After=network.target
StartLimitIntervalSec=0
[Service]
Type=simple
WorkingDirectory=$(pwd)
ExecStart=/bin/bash $(pwd)/mine.sh
Restart=always
RestartSec=3
TimeoutStartSec=0
[Install]
WantedBy=multi-user.target" >> /etc/systemd/system/coreverif.service
echo "$(tput setaf 3)●$(tput sgr 0) Reloading the daemon."
systemctl daemon-reload
echo "$(tput setaf 3)●$(tput sgr 0) Enabling the service."
systemctl enable coreverif.service
echo "$(tput setaf 3)●$(tput sgr 0) Starting the service."
systemctl start coreverif.service
echo "$(tput setaf 3)●$(tput sgr 0) Wiping the logs for retention for one day."
journalctl --rotate && journalctl --vacuum-time=1d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment