Obsolete:Misc scripts

From Wikitech
Jump to navigation Jump to search

Various misc useful scripts:

  • upload a local file to the wiki as an edit:
 /home/wikipedia/bin/upload en wikipedia /etc/passwd Wikipedia:Sandbox
  • count the number of contributions from a user:
 /home/wikipedia/bin/editcount en wikipedia Kate
  • make a function for each hostname, so that e.g.: browne ps will connect to browne and perform ps:
ALLNG=/usr/local/dsh/node_groups/ALL
if [ -r $ALLNG ]; then for host in $(<$ALLNG); $host() { ssh $0 $* }; fi
  • count stuff in mailq :
$ /home/wikipedia/bin/mailqcount
# of messages: 1584
# of errors  : 1770
# of rcpt-to : 1790
$
  • Get list of mysql servers according to db.php :
$ /home/wikipedia/bin/mysql-list
adler
samuel
ariel
ixia
thistle
lomaria
$
  • Get replication data for servers :
$ /home/wikipedia/bin/replication
SERVER adler
       Position: 220761719
SERVER samuel
  Read_Master_Log_Pos: 220761719
  Exec_master_log_pos: 220761719
SERVER ariel
  Read_Master_Log_Pos: 220761719
  Exec_master_log_pos: 220761719
SERVER ixia
  Read_Master_Log_Pos: 220761719
  Exec_master_log_pos: 220761719
SERVER thistle
  Read_Master_Log_Pos: 220761719
  Exec_master_log_pos: 220761719
SERVER lomaria
  Read_Master_Log_Pos: 220763426
  Exec_master_log_pos: 220763426
$