Skip to content

Instantly share code, notes, and snippets.

View toxinu's full-sized avatar

Geoffrey toxinu

View GitHub Profile
@toxinu
toxinu / shutdown_on_inactivity.sh
Created October 11, 2021 10:31
Shutdown server if no ssh
#!/bin/bash
#
# Shuts down the host on inactivity.
#
# Designed to be executed as root from a cron job.
# It will power off on the 2nd consecutive run without an active ssh session.
# That prevents an undesirable shutdown when the machine was just started, or on a brief disconnect.
#
# To enable, add this entry to /etc/crontab:
# */5 * * * * root /usr/local/bin/shutdown-if-inactive
@toxinu
toxinu / bash.sh
Created September 24, 2020 01:52
blog/jekyll-with-git-and-hooks
root@socketubs:/srv/gitosis/repositories/socket_site.git/hooks# cat post-receive
#!/bin/sh
echo "-- Attempting to pull and launch jekyll --"
cd /var/www/socket_site
git --git-dir /var/www/socket_site/.git pull file:///srv/.../socket_site.git/ master
jekyll
echo
@toxinu
toxinu / bash.sh
Created September 24, 2020 01:52
blog/jekyll-with-git-and-hooks
socketubs@socket-desktop:~/Repositories/canopsis$ ls -lh .git/hooks/
total 44K
-rwxrwxr-x 1 socketubs socketubs 452 2011-10-21 21:04 applypatch-msg.sample
-rwxrwxr-x 1 socketubs socketubs 896 2011-10-21 21:04 commit-msg.sample
-rwxrwxr-x 1 socketubs socketubs 160 2011-10-21 21:04 post-commit.sample
-rwxrwxr-x 1 socketubs socketubs 552 2011-10-21 21:04 post-receive.sample
-rwxrwxr-x 1 socketubs socketubs 189 2011-10-21 21:04 post-update.sample
...
@toxinu
toxinu / bash.sh
Created September 24, 2020 01:51
blog/nagios-oracle-health-plugin
wget http://labs.consol.de/wp-content/uploads/2011/09/check_oracle_health-1.7.6.1.tar.gz
tar xvf check_oracle_health-1.7.6.1.tar.gz
cd !$
./configure
make
make install
@toxinu
toxinu / tnsnames.ora
Created September 24, 2020 01:51
blog/nagios-oracle-health-plugin
<addressname> =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(Host = <hostname>)(Port = <port>))
)
(CONNECT_DATA =
(SERVICE_NAME = <sid>)
)
)
@toxinu
toxinu / bash.sh
Created September 24, 2020 01:50
blog/nagios-oracle-health-plugin
mkdir -p /opt/instantclient_11_2/network/admin
vim !$/tnsnames.ora
@toxinu
toxinu / bash.sh
Created September 24, 2020 01:50
blog/nagios-oracle-health-plugin
perl Makefile.PL -V 11.2
make
make install
@toxinu
toxinu / bash.sh
Created September 24, 2020 01:49
blog/nagios-oracle-health-plugin
export ORACLE_HOME=/opt/instantclient_11_2
export LD_LIBRARY_PATH=$ORACLE_HOME
echo 'ORACLE_HOME="/opt/instantclient_11_2"' >> /etc/environment
echo 'LD_LIBRARY_PATH=$ORACLE_HOME' >> /etc/environment
@toxinu
toxinu / bash.sh
Created September 24, 2020 01:49
blog/nagios-oracle-health-plugin
wget http://search.cpan.org/CPAN/authors/id/P/PY/PYTHIAN/DBD-Oracle-1.56.tar.gz
tar xvf DBD-Oracle-1.56.tar.gz
cd !$
@toxinu
toxinu / bash.sh
Created September 24, 2020 01:49
blog/nagios-oracle-health-plugin
apt-get install libaio-dev
cpan DBI