From a515c3ce530aba411e0d8f90de071ede90318142 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Tue, 23 Jun 2009 10:43:50 -0700 Subject: other base directories --- scripts/setup.cfg.sample | 2 ++ scripts/setup_status_network.sh | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/scripts/setup.cfg.sample b/scripts/setup.cfg.sample index dd3c2705f..ef33cd632 100644 --- a/scripts/setup.cfg.sample +++ b/scripts/setup.cfg.sample @@ -9,5 +9,7 @@ export ADMIN=root export ADMINPASS=yourpassword export SITEDB=example_net_site export AVATARBASE=/var/www/avatar.example.net +export BACKGROUNDBASE=/var/www/background.example.net +export FILEBASE=/var/www/file.example.net export PWDGEN="pwgen 20" diff --git a/scripts/setup_status_network.sh b/scripts/setup_status_network.sh index 29ee010ed..f0bb2cae8 100755 --- a/scripts/setup_status_network.sh +++ b/scripts/setup_status_network.sh @@ -26,5 +26,7 @@ VALUES ('$nickname', '$DBHOST', '$username', '$password', '$database', '$sitenam ENDOFCOMMANDS -mkdir $AVATARBASE/$nickname -chmod a+w $AVATARBASE/$nickname +for top in $AVATARBASE $FILEBASE $BACKGROUNDBASE; do + mkdir $top/$nickname + chmod a+w $top/$nickname +done -- cgit v1.2.3-54-g00ecf From e22f73c72bc08aac15ae3eae66ffbb0987d6883e Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Tue, 23 Jun 2009 11:14:51 -0700 Subject: use /etc/laconica/setup.cfg instead of local file --- scripts/setup_status_network.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/setup_status_network.sh b/scripts/setup_status_network.sh index f0bb2cae8..0261a7f55 100755 --- a/scripts/setup_status_network.sh +++ b/scripts/setup_status_network.sh @@ -1,6 +1,6 @@ #!/bin/bash -source ./setup.cfg +source /etc/laconica/setup.cfg export nickname=$1 export sitename=$2 -- cgit v1.2.3-54-g00ecf From a4402eedb32d0933b11070a1f6f681d020ab270f Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Tue, 23 Jun 2009 11:22:54 -0700 Subject: use different name for connection and database --- scripts/setup.cfg.sample | 5 ++--- scripts/setup_status_network.sh | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) (limited to 'scripts') diff --git a/scripts/setup.cfg.sample b/scripts/setup.cfg.sample index ef33cd632..8d03b06f5 100644 --- a/scripts/setup.cfg.sample +++ b/scripts/setup.cfg.sample @@ -1,8 +1,7 @@ # CONFIGURATION FILE for setup_status_network.sh -# Base database name; full name will include nickname - -export DBHOST=masterdb.example.net +export DBHOST=localhost +export DBHOSTNAME=masterdb.example.net export DBBASE=_example_net export USERBASE=_example_net export ADMIN=root diff --git a/scripts/setup_status_network.sh b/scripts/setup_status_network.sh index 0261a7f55..17440640e 100755 --- a/scripts/setup_status_network.sh +++ b/scripts/setup_status_network.sh @@ -22,7 +22,7 @@ mysql -h $DBHOST -u $ADMIN --password=$ADMINPASS $SITEDB << ENDOFCOMMANDS GRANT INSERT,SELECT,UPDATE,DELETE ON $database.* TO '$username'@'localhost' IDENTIFIED BY '$password'; GRANT INSERT,SELECT,UPDATE,DELETE ON $database.* TO '$username'@'%' IDENTIFIED BY '$password'; INSERT INTO status_network (nickname, dbhost, dbuser, dbpass, dbname, sitename, created) -VALUES ('$nickname', '$DBHOST', '$username', '$password', '$database', '$sitename', now()); +VALUES ('$nickname', '$DBHOSTNAME', '$username', '$password', '$database', '$sitename', now()); ENDOFCOMMANDS -- cgit v1.2.3-54-g00ecf From 17319ac5ca01f2780c4deb63d37654543da3c996 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Tue, 23 Jun 2009 11:32:35 -0700 Subject: script to show all sites on a network --- scripts/allsites.php | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 scripts/allsites.php (limited to 'scripts') diff --git a/scripts/allsites.php b/scripts/allsites.php new file mode 100644 index 000000000..d6768c278 --- /dev/null +++ b/scripts/allsites.php @@ -0,0 +1,40 @@ +#!/usr/bin/env php +. + */ + +# Abort if called from a web server + +define('INSTALLDIR', realpath(dirname(__FILE__) . '/..')); + +$helptext = <<find()) { + while ($sn->fetch()) { + print "$sn->nickname\n"; + } +} \ No newline at end of file -- cgit v1.2.3-54-g00ecf From ec4192edcd72e0bd0f2330a8d69b0d138a37f1f4 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Tue, 23 Jun 2009 11:34:16 -0700 Subject: chmod allsites.php --- scripts/allsites.php | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 scripts/allsites.php (limited to 'scripts') diff --git a/scripts/allsites.php b/scripts/allsites.php old mode 100644 new mode 100755 -- cgit v1.2.3-54-g00ecf From 83b5e6be0244e8b8c971bcc11103c2e32b54efd6 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Tue, 23 Jun 2009 11:40:23 -0700 Subject: script to delete a status network --- scripts/delete_status_network.sh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 scripts/delete_status_network.sh (limited to 'scripts') diff --git a/scripts/delete_status_network.sh b/scripts/delete_status_network.sh new file mode 100644 index 000000000..1cf716849 --- /dev/null +++ b/scripts/delete_status_network.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +source /etc/laconica/setup.cfg + +export nickname=$1 + +export database=$nickname$DBBASE + +# Create the db + +mysqladmin -h $DBHOST -u $ADMIN --password=$ADMINPASS -f drop $database + +mysql -h $DBHOST -u $ADMIN --password=$ADMINPASS $SITEDB << ENDOFCOMMANDS + +delete from status_network where nickname = '$nickname'; + +ENDOFCOMMANDS + +for top in $AVATARBASE $FILEBASE $BACKGROUNDBASE; do + rmdir $top/$nickname +done -- cgit v1.2.3-54-g00ecf From 0032fa28f030616a345a2cdbc822235c381f2c12 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Tue, 23 Jun 2009 11:43:20 -0700 Subject: rm -Rf, not rmdir --- scripts/delete_status_network.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/delete_status_network.sh b/scripts/delete_status_network.sh index 1cf716849..32187382c 100644 --- a/scripts/delete_status_network.sh +++ b/scripts/delete_status_network.sh @@ -17,5 +17,5 @@ delete from status_network where nickname = '$nickname'; ENDOFCOMMANDS for top in $AVATARBASE $FILEBASE $BACKGROUNDBASE; do - rmdir $top/$nickname + rm -Rf $top/$nickname done -- cgit v1.2.3-54-g00ecf From 9505ef5bb39875f6090c8ed572391cff415531fd Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Tue, 23 Jun 2009 11:45:18 -0700 Subject: chmod +x delete_status_network.sh --- scripts/delete_status_network.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 scripts/delete_status_network.sh (limited to 'scripts') diff --git a/scripts/delete_status_network.sh b/scripts/delete_status_network.sh old mode 100644 new mode 100755 -- cgit v1.2.3-54-g00ecf From 8588d321201b1713a8b95704e9c6abd39eb80609 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Tue, 23 Jun 2009 15:00:10 -0700 Subject: pass through server and path args to daemons --- scripts/startdaemons.sh | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/startdaemons.sh b/scripts/startdaemons.sh index 053c4f8ee..4e87694fb 100755 --- a/scripts/startdaemons.sh +++ b/scripts/startdaemons.sh @@ -23,9 +23,19 @@ DIR=`dirname $0` DAEMONS=`php $DIR/getvaliddaemons.php` +ARGS= + +if [ $# -gt 0 ]; then + ARGS="$ARGS -s$1" +fi + +if [ $# -gt 1 ]; then + ARGS="$ARGS -p$2" +fi + for f in $DAEMONS; do echo -n "Starting $f..."; - php $DIR/$f + php $DIR/$f $ARGS echo "DONE." done -- cgit v1.2.3-54-g00ecf From f88d767f493c5780476450d92ddb8f27a6ea6caa Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Tue, 23 Jun 2009 16:44:00 -0700 Subject: add args to daemons fetch --- scripts/startdaemons.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'scripts') diff --git a/scripts/startdaemons.sh b/scripts/startdaemons.sh index 4e87694fb..7609abec4 100755 --- a/scripts/startdaemons.sh +++ b/scripts/startdaemons.sh @@ -20,9 +20,6 @@ # This program tries to start the daemons for Laconica. # Note that the 'maildaemon' needs to run as a mail filter. -DIR=`dirname $0` -DAEMONS=`php $DIR/getvaliddaemons.php` - ARGS= if [ $# -gt 0 ]; then @@ -33,6 +30,9 @@ if [ $# -gt 1 ]; then ARGS="$ARGS -p$2" fi +DIR=`dirname $0` +DAEMONS=`php $DIR/getvaliddaemons.php $ARGS` + for f in $DAEMONS; do echo -n "Starting $f..."; -- cgit v1.2.3-54-g00ecf From a9bbf29ca6741437f7c27f7a7757b4969d33d279 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Tue, 23 Jun 2009 17:08:33 -0700 Subject: use printf instead of echo for startdaemons.sh --- scripts/startdaemons.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/scripts/startdaemons.sh b/scripts/startdaemons.sh index 7609abec4..a44362b57 100755 --- a/scripts/startdaemons.sh +++ b/scripts/startdaemons.sh @@ -35,7 +35,8 @@ DAEMONS=`php $DIR/getvaliddaemons.php $ARGS` for f in $DAEMONS; do - echo -n "Starting $f..."; + printf "Starting $f..."; php $DIR/$f $ARGS - echo "DONE." + printf "DONE.\n" + done -- cgit v1.2.3-54-g00ecf From 5f1b97e2add1b525401deef290ba29937135d073 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Wed, 24 Jun 2009 18:02:17 -0700 Subject: no memcached queue handler --- scripts/getvaliddaemons.php | 3 --- 1 file changed, 3 deletions(-) (limited to 'scripts') diff --git a/scripts/getvaliddaemons.php b/scripts/getvaliddaemons.php index 198ea8fb9..97c230784 100755 --- a/scripts/getvaliddaemons.php +++ b/scripts/getvaliddaemons.php @@ -38,9 +38,6 @@ if(common_config('xmpp','enabled')) { echo "xmppdaemon.php jabberqueuehandler.php publicqueuehandler.php "; echo "xmppconfirmhandler.php "; } -if(common_config('memcached','enabled')) { - echo "memcachedqueuehandler.php "; -} if(common_config('twitterbridge','enabled')) { echo "twitterstatusfetcher.php "; } -- cgit v1.2.3-54-g00ecf From becfd6b3b5da57298137c3349efbd49fe347ccfd Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Wed, 24 Jun 2009 19:31:12 -0700 Subject: all daemons take an id parameter --- lib/xmppqueuehandler.php | 9 ++++----- scripts/jabberqueuehandler.php | 20 ++++++++++---------- scripts/publicqueuehandler.php | 20 ++++++++++---------- scripts/xmppconfirmhandler.php | 20 ++++++++++---------- scripts/xmppdaemon.php | 22 +++++++++++----------- 5 files changed, 45 insertions(+), 46 deletions(-) (limited to 'scripts') diff --git a/lib/xmppqueuehandler.php b/lib/xmppqueuehandler.php index a078cd9f7..986e09c25 100644 --- a/lib/xmppqueuehandler.php +++ b/lib/xmppqueuehandler.php @@ -22,7 +22,7 @@ if (!defined('LACONICA')) { exit(1); } require_once(INSTALLDIR.'/lib/queuehandler.php'); /** - * Common superclass for all XMPP-using queue handlers. They all need to + * Common superclass for all XMPP-using queue handlers. They all need to * service their message queues on idle, and forward any incoming messages * to the XMPP listener connection. So, we abstract out common code to a * superclass. @@ -30,12 +30,11 @@ require_once(INSTALLDIR.'/lib/queuehandler.php'); class XmppQueueHandler extends QueueHandler { - function start() { # Low priority; we don't want to receive messages $this->log(LOG_INFO, "INITIALIZE"); - $this->conn = jabber_connect($this->_id); + $this->conn = jabber_connect($this->_id.$this->transport()); if ($this->conn) { $this->conn->addEventHandler('message', 'forward_message', $this); $this->conn->addEventHandler('reconnect', 'handle_reconnect', $this); @@ -44,7 +43,7 @@ class XmppQueueHandler extends QueueHandler } return !is_null($this->conn); } - + function handle_reconnect(&$pl) { $this->conn->processUntil('session_start'); @@ -63,7 +62,7 @@ class XmppQueueHandler extends QueueHandler die($e->getMessage()); } } - + function forward_message(&$pl) { if ($pl['type'] != 'chat') { diff --git a/scripts/jabberqueuehandler.php b/scripts/jabberqueuehandler.php index a44993236..5b581629d 100755 --- a/scripts/jabberqueuehandler.php +++ b/scripts/jabberqueuehandler.php @@ -20,13 +20,13 @@ define('INSTALLDIR', realpath(dirname(__FILE__) . '/..')); -$shortoptions = 'r::'; -$longoptions = array('resource::'); +$shortoptions = 'i::'; +$longoptions = array('id::'); $helptext = << 0) { - $resource = $args[0]; + $id = $args[0]; } else { - $resource = null; + $id = null; } -$handler = new JabberQueueHandler($resource); +$handler = new JabberQueueHandler($id); $handler->runOnce(); diff --git a/scripts/publicqueuehandler.php b/scripts/publicqueuehandler.php index 58ecc1745..701d50e01 100755 --- a/scripts/publicqueuehandler.php +++ b/scripts/publicqueuehandler.php @@ -20,13 +20,13 @@ define('INSTALLDIR', realpath(dirname(__FILE__) . '/..')); -$shortoptions = 'r::'; -$longoptions = array('resource::'); +$shortoptions = 'i::'; +$longoptions = array('id::'); $helptext = << 0) { - $resource = $args[0]; + $id = $args[0]; } else { - $resource = null; + $id = null; } -$handler = new PublicQueueHandler($resource); +$handler = new PublicQueueHandler($id); $handler->runOnce(); diff --git a/scripts/xmppconfirmhandler.php b/scripts/xmppconfirmhandler.php index 883934fd6..d6821ddef 100755 --- a/scripts/xmppconfirmhandler.php +++ b/scripts/xmppconfirmhandler.php @@ -20,13 +20,13 @@ define('INSTALLDIR', realpath(dirname(__FILE__) . '/..')); -$shortoptions = 'r::'; -$longoptions = array('resource::'); +$shortoptions = 'i::'; +$longoptions = array('id::'); $helptext = << 0) { - $resource = $args[0]; + $id = $args[0]; } else { - $resource = null; + $id = null; } -$handler = new XmppConfirmHandler($resource); +$handler = new XmppConfirmHandler($id); $handler->runOnce(); diff --git a/scripts/xmppdaemon.php b/scripts/xmppdaemon.php index 661631937..3eecfec29 100755 --- a/scripts/xmppdaemon.php +++ b/scripts/xmppdaemon.php @@ -20,13 +20,13 @@ define('INSTALLDIR', realpath(dirname(__FILE__) . '/..')); -$shortoptions = 'r::'; -$longoptions = array('resource::'); +$shortoptions = 'i::'; +$longoptions = array('id::'); $helptext = <<resource = $resource; + $this->resource = $resource . 'daemon'; } else { $this->resource = common_config('xmpp', 'resource') . 'daemon'; } @@ -323,16 +323,16 @@ if (common_config('xmpp','enabled')==false) { exit(); } -if (have_option('r')) { - $resource = get_option_value('r'); -} else if (have_option('--resource')) { - $resource = get_option_value('--resource'); +if (have_option('i')) { + $id = get_option_value('i'); +} else if (have_option('--id')) { + $id = get_option_value('--id'); } else if (count($args) > 0) { - $resource = $args[0]; + $id = $args[0]; } else { - $resource = null; + $id = null; } -$daemon = new XMPPDaemon($resource); +$daemon = new XMPPDaemon($id); $daemon->runOnce(); -- cgit v1.2.3-54-g00ecf From 6038420a69096854e386b8e9dcdc5993d7e9af8f Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Wed, 24 Jun 2009 19:35:19 -0700 Subject: add i argument for all daemons --- scripts/startdaemons.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/startdaemons.sh b/scripts/startdaemons.sh index a44362b57..8b7451cd7 100755 --- a/scripts/startdaemons.sh +++ b/scripts/startdaemons.sh @@ -23,7 +23,8 @@ ARGS= if [ $# -gt 0 ]; then - ARGS="$ARGS -s$1" + ID=`echo $1 | sed s/\\\\./_/g` + ARGS="$ARGS -s$1 -i$ID" fi if [ $# -gt 1 ]; then -- cgit v1.2.3-54-g00ecf From 246013d984245737983054abf7496aa3879cfc58 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Wed, 24 Jun 2009 19:50:45 -0700 Subject: different args for pid and daemon scripts --- scripts/startdaemons.sh | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'scripts') diff --git a/scripts/startdaemons.sh b/scripts/startdaemons.sh index 8b7451cd7..9ead20acd 100755 --- a/scripts/startdaemons.sh +++ b/scripts/startdaemons.sh @@ -20,24 +20,27 @@ # This program tries to start the daemons for Laconica. # Note that the 'maildaemon' needs to run as a mail filter. -ARGS= +ARGSG= +ARGSD= if [ $# -gt 0 ]; then + ARGSG="$ARGSG -s$1" ID=`echo $1 | sed s/\\\\./_/g` - ARGS="$ARGS -s$1 -i$ID" + ARGSD="$ARGSD -s$1 -i$ID" fi if [ $# -gt 1 ]; then - ARGS="$ARGS -p$2" + ARGSD="$ARGSD -p$2" + ARGSG="$ARGSG -p$2" fi DIR=`dirname $0` -DAEMONS=`php $DIR/getvaliddaemons.php $ARGS` +DAEMONS=`php $DIR/getvaliddaemons.php $ARGSG` for f in $DAEMONS; do printf "Starting $f..."; - php $DIR/$f $ARGS + php $DIR/$f $ARGSD printf "DONE.\n" done -- cgit v1.2.3-54-g00ecf