#!/bin/sh
# Bash script to do mysql query for ftp password, to be run from Event Manager
# upon Physical Hosting Creation trigger
#
# Set it up in Event Manager to be passed the following arguments:
# argument list:
# $1=<new_system_user>
#
PSA_USERNAME=$1
# Note that this is the ` quote not the ' quote
PSA_PASSWORD=`
mysql -uadmin -pYourAdminPassword -N psa<< eof
SELECT a.password FROM accounts a, sys_users s WHERE login LIKE '$PSA_USERNAME' and a.id = s.account_id;
eof`
# Note that this is the ` quote, not the ' quote
echo $PSA_USERNAME >>/tmp/event_handler.log
echo $PSA_PASSWORD >>/tmp/event_handler.log
# Make sure to change the 'YourAdminPassword' to the real admin password
# You can now put in code here to use these variables to formulate an email
# to be sent to the user.
#
# Save this file and 'chmod +x filename'
# $1=<new_system_user>
what value must i set for PSA_Password?# Note that this is the ` quote not the ' quote
PSA_PASSWORD=`
oh no problem i would like only learn im not hosting now in moment but o would like test anything for learnI am not going to write the entire script for you. Hosting admins should take the time to do research and at least learn some basics. (Sorry, Not a 'happy' day for me today)
Originally posted by jamesyeeoc
PSA_PASSWORD=`
mysql -uadmin -pYourAdminPassword -N psa<< eof
SELECT a.password FROM accounts a, sys_users s WHERE login LIKE '$PSA_USERNAME' and a.id = s.account_id;
eof`
PSA_PASSWORD=`mysql -uadmin -p\`cat /etc/psa/.psa.shadow\` -N psa<< eof
SELECT a.password FROM accounts a, sys_users s WHERE login LIKE '$PSA_USERNAME' and a.id = s.account_id;
eof`
Originally posted by jamesyeeoc Thanks Geert, a very valid point. I'm slipping in my old age
Code:PSA_PASSWORD=` mysql -uadmin -pYourAdminPassword -N psa<< eof SELECT a.password FROM accounts a, sys_users s WHERE login LIKE '$PSA_USERNAME' and a.id = s.account_id; eof`
To something like this:
Code:PSA_PASSWORD=`mysql -uadmin -p\`cat /etc/psa/.psa.shadow\` -N psa<< eof SELECT a.password FROM accounts a, sys_users s WHERE login LIKE '$PSA_USERNAME' and a.id = s.account_id; eof`
Originally posted by bloosk
but have you a answer of my ask with the tamplate in a .sh script ?
<new_system_user> = (already passed as $1)
<new_domain_name> =$4
In the script you can build a variable ($e_address)which will consist of:
$1 + "@" + $4
#!/usr/bin/php
<?php
$username = $argv[1];
$passwort = $argv[2];
$mailsender = $argv[3];
$mailversand = "
-------------
Username : $username<br>
-------------
Passwort : $passwort<br>
-------------
Email : $mailsender<br>
-------------
";
$header="From: [email][email protected][/email]\n";
$header .= "X-Mailer: PHP/" . phpversion(). "\n";
$header .= "X-Sender-IP: $REMOTE_ADDR\n";
$header .= "Content-Type: text/html";
mail($mailsender,"FTP Zugangsdaten",$mailversand,$header);
#!/bin/sh
PSA_USERNAME=$1
PSA_DOMAINNAME=$2
PSA_PASSWORD=`mysql -uadmin -p\`cat /etc/psa/.psa.shadow\` -N psa<< eof
SELECT a.password FROM accounts a, sys_users s WHERE login LIKE '$PSA_USERNAME' and a.id = s.account_id;
eof`
PSA_EMAIL=`mysql -uadmin -p\`cat /etc/psa/.psa.shadow\` -N psa<< eof
SELECT a.email FROM clients a, domains s WHERE displayName LIKE '$PSA_DOMAINNAME' and a.id = s.cl_id;
eof`
/usr/local/psa/admin/plib/modules/sbm/mailftp.php $PSA_USERNAME $PSA_PASSWORD $PSA_EMAIL >/dev/null 2>&1
Physical Hosting Created
root
/usr/local/psa/admin/plib/modules/sbm/ftpemail.sh <new_system_user> <new_domain_name>
right neat solution or gives a other solution it is better