Problem:
Customer is not able to get the 'aliases' definitions for each specific user.
Environment:
WAAE 11.3.x
Resolution:
The alias setting is not interpreted at the job runtime such as the environment variable setting.
'alias' is a unix command, it forks a process.
In order to get the aliases defined for a user profile, you can use the attribute profile in the job definition as follows:
* ----------------- TEST1 ----------------- */
insert_job: TEST1 job_type: CMD
command: "alias > /home/sample/alias.txt"
machine: mymachine
owner: user1
permission:
date_conditions: 0
std_out_file: /home/log/${AUTO_JOB_NAME}_${AUTORUN}.log
std_err_file: /home/log/${AUTO_JOB_NAME}_${AUTORUN}.err
alarm_if_fail: 0
profile: /home/conf/user1/.profile
- This is extraction from the .profile of user 'user1'
...
alias lm='ls -al | more'
alias ll='ls -l'
alias la='ls -la'
alias lrt='ls -alrt'
...
- extraction from agentparm.txt
# this tells the agent to switch to the user home
oscomponent.initialworkingdirectory=USER
- The result after run the job
root: vi /home/sample/alias.txt
...
la='ls -la'
ll='ls -l'
lm='ls -al | more'
lrt='ls -alrt'
....
Additional Information:
As autosys do not use 'su - ' when run a user .profile, we can use the following workaround in the job definition:
command: "su - user1; alias > /home/sample/alias.txt"
owner: root