Is it possible to know the username executing a cap task to use it from inside Capfile? - capistrano

Do you know if it's possible to access the username running the 'cap deploy' task to use it from a cap task in the Capfile?
For example, we need to mark a deploy in newrelic after doing a deploy, so I added a task "mark_deploy" in the capfile that does the work. The problem is that it will be nice to register the user running the 'cap deploy', but for that I need to know the username at the time the "mark" task is invoked.
Thanks in advance!

It's solved, I discovered that there is a global variable in Capistrano that you can use just for this:
#{local_user}
Thanks for the help!

Related

Schedule scripts to run every so often

I was following the platzi tutorial on writing a script - https://courses.platzi.com/classes/sails-js/concepto/growth-and-monetization6001/notifications/material/ - Notifications.
He writes the script but doesn't show us how to schedule it to run. Does anyone know how to do this?
You can set it to run as a scheduled job on your cloud platform like Heroku.
If you use Heroku you can install the Heroku Scheduler as an add on. Then you configure it to run your script.
sails run send-email-reminders

Glpi automatic action

I have a problem with an automatic action in GLPI, since the "Queuedmail", which is the action that sends the mail in queue every 1 minute according to my configuration, is not working, I do not know what to do, the only way to make it work is by manually executing it.
The version I use of GLPI is 9.1.6
This is very little information.
You need to check:
Quedmail Status: Is it set to Scheduled?
Quedmail Run mode:
If set to CLI you need to add a cron job (This is recommended). http://wiki.glpi-project.org/doku.php?id=en:config:crontab
Just for testing, change Run mode to GLPI. It would run based on anyones GLPi usage.
Regards,

Non-interactive Rake task "db:initial_setup"

I'm trying to automate the installation of canvas LMS which requires the execution of
bundle exec rake db:initial_setup
which asks for an admin email and password interactively
How do I pass those values in a non-interactive way?
It should be done by setting the following environmental variables :
CANVAS_LMS_ADMIN_EMAIL
CANVAS_LMS_ADMIN_PASSWORD
CANVAS_LMS_STATS_COLLECTION
CANVAS_LMS_ACCOUNT_NAME
I realize it's a late addition, but to clarify Eslam's answer, the details you're seeking are on the Production Start page under the Database Population heading.

Why I have to provide account info to run mysqldump.exe through scheduled task in Windows 7

I created a task in my Win7, to run php.exe. The command is: C:\xampp\php\php.exe -q "C:\xampp\htdocs\creport\cleaner.php", and it works fine.
Then I created another task to run mysqldump.exe. The command is: C:\xampp\mysql\bin\mysqldump.exe -u root -pvince c_report > C:\dbfiles\backup-"%DATE:/=-%.sql", but when creating the task a window popped up asking for account information like:
[Sorry I don't have enough reputation to insert an image in my post]
Why is that? I mean, why are the two .exe files treated differently? And probably just because of that, I always failed to run mysqldump.exe though the task, it failed with last-run-result being 0x6.
Thanks a lot for any help!
Actually I was fooled. I just found that the whether does the window pop up has nothing to do with which exe this task is scheduled to run. It comes up just because I has ticked option [Run whether user is logged on or not], therefore, in the case that user account is logged out, Windows need to store the password to log it in to run the task.

Map drive in powershell through Scheduled Task without credentials

I'm trying to run a powershell backup script as a scheduled task, and as a part of this I need to map a network drive (before copying the backup to the remote host).
Now, this was working when I had it like this:
NET use $RemoteDir $RemoteUser $BackupPass
But due to security concerns, I can't keep the password in plain text, or anywhere on the server. So, my hope was that, since it's run as a scheduled task, 'NET' would be able to "inherit" the credentials from the user running the scheduled task, so that it could be run like this:
NET use $RemoteDir
But it doesn't seem to work, when I log the error I get:
The password is invalid for <RemoteDir>.
Enter the user name for <RemoteDir>':
So, my question is: Is there any way to get this to work? I.e. having NET use the credentials that the scheduled job is running with? Or do I need to find another approach?
Edit: Forgot to mention, the user running the scheduled task is a domain user, and it has access to the remote.
Thanks!
Create a domain account. Assign the account permissions to the share and NTFS directory. Set the task to execute under the account you just created.
I dont have the solution, but a work arround.
You can store a password in a file locked down to say "domain admin" like the suggestion above and follow the directions on this link:
http://geekswithblogs.net/Lance/archive/2007/02/16/106518.aspx
Seems weird, I manage station users from scheduled task without any problem, so it is possible to use the credentials. Maybe the net use is just misbehaving, have you tried using New-PSDrive instead?