Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- HOST="${1}"
- LAST="$(mysql piwik -Be "SELECT idsite FROM piwik_site" | tail -1 )"
- NEW="$(( ${LAST} +1 ))"
- DATE="$( date +'%Y-%m-%d %H:%M:%S' )"
- # get args
- [ "${#}" = 1 ] || { echo "Usage: ${0} <HOSTNAME>" ; exit 1; }
- # check if existent
- if ! ( mysql piwik -Be "SELECT main_url FROM piwik_site" | grep -q "${HOST}" ) ; then
- echo -e "insert into database: mysql piwik -Be \"INSERT INTO \`piwik_site\` VALUES (${NEW},'$WEBSITE','http://${WEBSITE}','${DATE}',0,'Europe/Amsterdam','EUR','','','',NULL);\""
- else
- echo -e "${HOST} allready exists in database" ; exit 1
- fi
Advertisement
Add Comment
Please, Sign In to add comment