by willemkokke
0 deployments · 0 still active · last rev. 3 years ago

This is a library of utility functions

Do not deploy directly, but include it with:

source <ssinclude StackScriptID=14154>


Compatible with: Ubuntu 14.04 LTS

function log {
    # log(string)
    echo `date +"%Y-%m-%d %H:%M:%S"` $1 >> ~/StackScript.log

function lowercase {
    # lowercase(string)
    echo $1 | tr '[:upper:]' '[:lower:]'

function restart_services {
    # restart all services that have a file in /tmp/restart

    for service in $(ls /tmp/restart-* | cut -d- -f2-10); do
        log "Restarting service $service"
        restart $service
        rm -f /tmp/restart-$service

function system_update {
    log "Updating server packages using aptitude"
    apt-get update
    apt-get -y install aptitude
    aptitude -y full-upgrade
    log "Updating server packages done"