Writing a single batch file for all rake tasks
I am using redmine issue creation by email functionality.
I have used the rake tasks to create issues on particular project
This is that following rake task
rake redmine:email:receive_imap RAILS_ENV="production" host=myhostaddress port=portno ssl=1 username=myemail11 password=mypassword1 project=myprojectname1 tracker=mytracker1 status=mystatus1 Priority=mypriority1 allow_override=project,status,tracker,priority
This rake task will create issues on myprojectname1
rake redmine:email:receive_imap RAILS_ENV="production" host=myhostaddress port=portno ssl=1 username=myemail2 password=mypassword2 project=myprojectname2 tracker=mytracker2 status=mystatus2 Priority=mypriority2 allow_override=project,status,tracker,priority
This will create issues on myprojectname2
Like this i want to write many rake tasks .All the rake tasks are configured to diff email address.
Is it possible for me to write all the rake tasks in a single batch file and schedule that one in cron tab.whether it will work
#1 Updated by Adam Piotr Żochowski about 13 years ago
Since you are mentioning Batch files, I am assuming you are doing this under Windows.
just create a batch file that will look like named something like : cron.hourly.cmd
:: process hourly emails @call rake redmine:email:receive_imap RAILS_ENV="production" host=myhostad... @call rake redmine:email:receive_imap RAILS_ENV="production" host=myhostad..
A line that starts with two colons is a comment
A line that starts with '@' sign is not output to stdout (typical batch files work as if ran 'bash -x', to avoid this behaviour either add a line '@echo off' or prefix each line with an at sign).
Batch file calling a batch file behaves like a 'goto', meaning if you do not say 'call' your first rake will finish execution and never return to your batch files.
Now you can setup a schedule to run this batch file every hour in the windows task scheduler (or by using at command).