Skip to content
Trey Stafford edited this page Jul 31, 2014 · 5 revisions

Services

To start/stop the basic services you use the service command.

service httpd [start/stop/restart/reload]

service tomcat6 [start/stop/restart/reload]

service postgresql-9.3 [start/stop/restart/reload]

service crond [start/stop/restart/reload]

Software Update/Installation

You can use the YUM package manager to install/update software.

yum update [package name]

yum install [package name]

The -y flag can be used to automatically accept the installation/update without needing user input.

yum update -y

Activation Python Virtual Environment

source /usr/bin/venv/bin/activate will start the virtual environment. All python installations/commands you run from this interface will use Python 2.7.6 and packages that are installed in the virtual environment. venv is the name we chose for the virtual environment and is not a built-in name.

Installing Python tools

With the venv activated you can use pip to install tools.

Either:

python-pip install [package] which is the CentOS PiP wrapper.

OR

pip install [package] which is an alias to python-pip.

CRON

CRON is a tool that runs scheduled tasks. The CRON configuration is written in provisions.sh

SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=''
HOME=/

# REMOVE CSV FILES OLDER THAN 7 DAYS AT 2 AM DAILY
0 2 * * * root rm -f $(find "$webDataDir"/csv/*.csv -mtime +7);
0 2 * * * root rm -f $(find "$webDataDir"/kml/*.kml -mtime +7); 
0 2 * * * root rm -f $(find "$webDataDir"/mat/*.mat -mtime +7);
0 2 * * * root rm -f $(find "$webDataDir"/reports/*.csv -mtime +7);
0 2 * * * root rm -f $(find "$webDataDir"/datapacks/*.tar.gz -mtime +7);

# VACUUM ANALYZE THE ENTIRE OPS DATABASE AT 2 AM DAILY
0 2 * * * root sh /vagrant/conf/tools/vacuumAnalyze.sh ops

# WEEKLY POSTGRESQL REPORT CREATION AT 2 AM SUNDAY
0 2 * * 7 root sh /vagrant/conf/tools/createPostgresqlReport.sh "$snfsBasePath"postgresql_reports/

# REMOVE POSTGRESQL REPORTS OLDER THAN 2 MONTHS EVERY SUNDAY AT 2 AM
0 2 * * 7 root rm -f $(find "$snfsBasePath"postgresql_reports/*.html -mtime +60);

# CLEAR THE CONTENTS OF THE DJANGO LOGS EVERY MONTH (FIRST OF MONTH, 2 AM)
0 2 1 * * root > /cresis/snfs1/web/ops2/django_logs/createPath.log;

More information on CentOS CRON is here