User Permissions
Hi.
I have made a bash script that gets the users permissions from another file, the bash script works fine and the fop2.cfg file can execute it. However, the output configurations from my bash file aren't being applied to the configuration.
Below is my bash script which prints out the new user permissions in the correct syntax
Perhaps some line issue with the echo? not recognizing the line break?
Also can anybody tell me when the fop2.cfg is executed. Eg. is the configuration re-run when users log in, or does the fop2.cfg only re-run when the service is restarted?
Cheers.
I have made a bash script that gets the users permissions from another file, the bash script works fine and the fop2.cfg file can execute it. However, the output configurations from my bash file aren't being applied to the configuration.
Below is my bash script which prints out the new user permissions in the correct syntax
#!/bin/bash
for USER in `cat /etc/asterisk/voicemail.conf | grep "=>" | cut -d, -f1 | sed 's/ => /:/g'`
do
echo "$USER" > tmpUserFile
USEREXT=`cat ./tmpUserFile | cut -d, -f1 | sed 's/ => /:/g' | cut -d: -f1`
for CHKUSER in `cat ./manual-user-rights.cfg | cut -d: -f1`;
do
if [ "$USEREXT" == "$CHKUSER" ]
then
USERRIGHTS=`cat ./manual-user-rights.cfg | grep "$USEREXT" | cut -d: -f2`;
echo "user=$USER:$USERRIGHTS";
fi
done
rm -r ./tmpUserFile
done
echo "buttonfile=autobuttons.cfg"
Perhaps some line issue with the echo? not recognizing the line break?
Also can anybody tell me when the fop2.cfg is executed. Eg. is the configuration re-run when users log in, or does the fop2.cfg only re-run when the service is restarted?
Cheers.
Comments
It seems your script is not writing the user secret ?
The script is executed every time you start or reload fop2_server . The reload is done by sending a HUP signal to the process.
Best regards,
The user secret and extension are both held in the $USER variable.
Thanks about the reload info.
This is the revised code.
When I call the script directly it executes fine, with correct output. When I execute 'fop2_server restart'. It executes the script but the config from the script doesn't seem to be loading. When I execute 'service fop2 restart' the script doesn't even get executed.
Output from the script when called directly:
The format of 'manual-user-rights.cfg' is:
It doesn't appear to be a file permission issue as I am using the default file. If I use the default script, It runs when 'service fop2 restart' and 'fop2_server restart' are executed whereas if I use my code, it only runs on 'fop2_server restart'
Any help would be greatly appreciated
The "start, stop, restart" are only available on the init script, not on fop2_server itself. If the init script works fine, your #exec script will be executed. Remember that you have to set the execute permissions to your script too...
Best regards,
PS: I am online now, and will be online for one more hour.