Create issue from CRON
Added by Nahuel E over 13 years ago
Hi,
If someone is interested, i'm using this bash script to create periodically issues with linux CRON.
Crontab:
0 23 * * 4 /opt/redmine/create_issue.sh /opt/redmine/issue_backup.xml >/dev/null 2>&1
File: issue_backup.xml
<?xml version="1.0"?> <issue> <subject>Realizar Backup</subject> <project_id>1</project_id> <assigned_to_id>2</assigned_to_id> <priority_id>4</priority_id> </issue>
More issue parameteres, visit: http://www.redmine.org/projects/redmine/wiki/Rest_Issues
File: create_issue.sh
#!/bin/sh # # Crea un issue en el redmine # XML_POST=$1 # Parametros LOG_FILE=/var/log/redmine/create_redmine_issue.log BASEURL=http://192.168.0.5:3000 USERNAME=cron_username PWD=passw_cron TMPFILE=tmp_login.tmp # Opciones del WGET WOPTS="--cookies=on --load-cookies cookies.txt --keep-session-cookies --save-cookies cookies.txt -o$LOG_FILE" # Obtengo auth token wget -O$TMPFILE $WOPTS $BASEURL/login/ AUTH1=$(grep authenticity $TMPFILE | cut -d\" -f12) AUTH=$(perl -MURI::Escape -e "print uri_escape('$AUTH1');") # Me logueo wget $BASEURL/login/ $WOPTS --post-data=authenticity_token=$AUTH\&username=$USERNAME\&password=$PWD\&login=Login -O$TMPFILE # Creo el issue wget -O /dev/null $WOPTS "$BASEURL/issues.xml" --post-file="$XML_POST" --header="Content-Type:text/xml" rm $TMPFILE rm cookies.txtYou only need to change:
- BASEURL=http://192.168.0.5:3000
- USERNAME=cron_username
- PWD=passw_cron
Hope help somebody !
cheers,
NahuelE
www.arquimeda.com