Using script command for installation script on AIX
Clash Royale CLAN TAG#URR8PPP
up vote
3
down vote
favorite
I have an installation script for my software and I need it to run on both, Linux and AIX.
On Linux I can use a wrapper myinstaller.ksh
like this one:
#!/usr/bin/ksh
script -c myrealinstaller.ksh /var/log/myinstaller.log
But on AIX script
does not support the -c
option.
How can I run my myrealinstaller.ksh
inside the forked shell created by script?
scripting ksh aix
add a comment |Â
up vote
3
down vote
favorite
I have an installation script for my software and I need it to run on both, Linux and AIX.
On Linux I can use a wrapper myinstaller.ksh
like this one:
#!/usr/bin/ksh
script -c myrealinstaller.ksh /var/log/myinstaller.log
But on AIX script
does not support the -c
option.
How can I run my myrealinstaller.ksh
inside the forked shell created by script?
scripting ksh aix
add a comment |Â
up vote
3
down vote
favorite
up vote
3
down vote
favorite
I have an installation script for my software and I need it to run on both, Linux and AIX.
On Linux I can use a wrapper myinstaller.ksh
like this one:
#!/usr/bin/ksh
script -c myrealinstaller.ksh /var/log/myinstaller.log
But on AIX script
does not support the -c
option.
How can I run my myrealinstaller.ksh
inside the forked shell created by script?
scripting ksh aix
I have an installation script for my software and I need it to run on both, Linux and AIX.
On Linux I can use a wrapper myinstaller.ksh
like this one:
#!/usr/bin/ksh
script -c myrealinstaller.ksh /var/log/myinstaller.log
But on AIX script
does not support the -c
option.
How can I run my myrealinstaller.ksh
inside the forked shell created by script?
scripting ksh aix
edited Mar 15 at 13:09
Stephen Kitt
141k22307367
141k22307367
asked Mar 15 at 12:45
Patrick
898
898
add a comment |Â
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
1
down vote
accepted
You could enhance your wrapper script to detect the OS; if it's running on Linux, execute script -c ...
, but if it's running on AIX, give the script-shell an overridden profile that only runs your installer, then exits:
$ cat myinstaller.ksh
#!/usr/bin/ksh
case $(uname -s) in
(Linux)
script -c myrealinstaller.ksh /var/log/myinstaller.log
;;
(AIX)
printf "ENV= ./myrealinstaller.kshnexitn" > ./installer.profile
trap 'rm -f ./installer.profile' INT
ENV=./installer.profile script -q ./var/log/myinstaller.log
rm ./installer.profile
;;
esac
I adjusted the paths to the script and logs to test it locally. The other factors involved are:
- setting
ENV
to point to the overridden profile as we callscript
- calling
script
with-q
to quiet it down a bit - importantly, unsetting ENV during the call to the real installer, so that we don't loop infinitely
- telling the overridden profile to exit as soon as the installer is done
With a sample myrealinstaller.ksh of:
#!/bin/ksh
echo Hi, I am the real installer
The contents of ./var/log/myinstaller.log are:
Script command is started on Thu Mar 15 09:34:04 2018.
Hi, I am the real installer
Script command is complete on Thu Mar 15 09:34:04 2018.
Nice, this works very well. The only problem I found is the installer.profile which is not removed if the real installer is interrupted by ctrl+c.
â Patrick
Mar 15 at 15:05
Glad to hear that it works, @P.Jksch! I've added a line to remove the installer.profile intermediate file if the user hits Control-C.
â Jeff Schaller
Mar 15 at 15:20
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
accepted
You could enhance your wrapper script to detect the OS; if it's running on Linux, execute script -c ...
, but if it's running on AIX, give the script-shell an overridden profile that only runs your installer, then exits:
$ cat myinstaller.ksh
#!/usr/bin/ksh
case $(uname -s) in
(Linux)
script -c myrealinstaller.ksh /var/log/myinstaller.log
;;
(AIX)
printf "ENV= ./myrealinstaller.kshnexitn" > ./installer.profile
trap 'rm -f ./installer.profile' INT
ENV=./installer.profile script -q ./var/log/myinstaller.log
rm ./installer.profile
;;
esac
I adjusted the paths to the script and logs to test it locally. The other factors involved are:
- setting
ENV
to point to the overridden profile as we callscript
- calling
script
with-q
to quiet it down a bit - importantly, unsetting ENV during the call to the real installer, so that we don't loop infinitely
- telling the overridden profile to exit as soon as the installer is done
With a sample myrealinstaller.ksh of:
#!/bin/ksh
echo Hi, I am the real installer
The contents of ./var/log/myinstaller.log are:
Script command is started on Thu Mar 15 09:34:04 2018.
Hi, I am the real installer
Script command is complete on Thu Mar 15 09:34:04 2018.
Nice, this works very well. The only problem I found is the installer.profile which is not removed if the real installer is interrupted by ctrl+c.
â Patrick
Mar 15 at 15:05
Glad to hear that it works, @P.Jksch! I've added a line to remove the installer.profile intermediate file if the user hits Control-C.
â Jeff Schaller
Mar 15 at 15:20
add a comment |Â
up vote
1
down vote
accepted
You could enhance your wrapper script to detect the OS; if it's running on Linux, execute script -c ...
, but if it's running on AIX, give the script-shell an overridden profile that only runs your installer, then exits:
$ cat myinstaller.ksh
#!/usr/bin/ksh
case $(uname -s) in
(Linux)
script -c myrealinstaller.ksh /var/log/myinstaller.log
;;
(AIX)
printf "ENV= ./myrealinstaller.kshnexitn" > ./installer.profile
trap 'rm -f ./installer.profile' INT
ENV=./installer.profile script -q ./var/log/myinstaller.log
rm ./installer.profile
;;
esac
I adjusted the paths to the script and logs to test it locally. The other factors involved are:
- setting
ENV
to point to the overridden profile as we callscript
- calling
script
with-q
to quiet it down a bit - importantly, unsetting ENV during the call to the real installer, so that we don't loop infinitely
- telling the overridden profile to exit as soon as the installer is done
With a sample myrealinstaller.ksh of:
#!/bin/ksh
echo Hi, I am the real installer
The contents of ./var/log/myinstaller.log are:
Script command is started on Thu Mar 15 09:34:04 2018.
Hi, I am the real installer
Script command is complete on Thu Mar 15 09:34:04 2018.
Nice, this works very well. The only problem I found is the installer.profile which is not removed if the real installer is interrupted by ctrl+c.
â Patrick
Mar 15 at 15:05
Glad to hear that it works, @P.Jksch! I've added a line to remove the installer.profile intermediate file if the user hits Control-C.
â Jeff Schaller
Mar 15 at 15:20
add a comment |Â
up vote
1
down vote
accepted
up vote
1
down vote
accepted
You could enhance your wrapper script to detect the OS; if it's running on Linux, execute script -c ...
, but if it's running on AIX, give the script-shell an overridden profile that only runs your installer, then exits:
$ cat myinstaller.ksh
#!/usr/bin/ksh
case $(uname -s) in
(Linux)
script -c myrealinstaller.ksh /var/log/myinstaller.log
;;
(AIX)
printf "ENV= ./myrealinstaller.kshnexitn" > ./installer.profile
trap 'rm -f ./installer.profile' INT
ENV=./installer.profile script -q ./var/log/myinstaller.log
rm ./installer.profile
;;
esac
I adjusted the paths to the script and logs to test it locally. The other factors involved are:
- setting
ENV
to point to the overridden profile as we callscript
- calling
script
with-q
to quiet it down a bit - importantly, unsetting ENV during the call to the real installer, so that we don't loop infinitely
- telling the overridden profile to exit as soon as the installer is done
With a sample myrealinstaller.ksh of:
#!/bin/ksh
echo Hi, I am the real installer
The contents of ./var/log/myinstaller.log are:
Script command is started on Thu Mar 15 09:34:04 2018.
Hi, I am the real installer
Script command is complete on Thu Mar 15 09:34:04 2018.
You could enhance your wrapper script to detect the OS; if it's running on Linux, execute script -c ...
, but if it's running on AIX, give the script-shell an overridden profile that only runs your installer, then exits:
$ cat myinstaller.ksh
#!/usr/bin/ksh
case $(uname -s) in
(Linux)
script -c myrealinstaller.ksh /var/log/myinstaller.log
;;
(AIX)
printf "ENV= ./myrealinstaller.kshnexitn" > ./installer.profile
trap 'rm -f ./installer.profile' INT
ENV=./installer.profile script -q ./var/log/myinstaller.log
rm ./installer.profile
;;
esac
I adjusted the paths to the script and logs to test it locally. The other factors involved are:
- setting
ENV
to point to the overridden profile as we callscript
- calling
script
with-q
to quiet it down a bit - importantly, unsetting ENV during the call to the real installer, so that we don't loop infinitely
- telling the overridden profile to exit as soon as the installer is done
With a sample myrealinstaller.ksh of:
#!/bin/ksh
echo Hi, I am the real installer
The contents of ./var/log/myinstaller.log are:
Script command is started on Thu Mar 15 09:34:04 2018.
Hi, I am the real installer
Script command is complete on Thu Mar 15 09:34:04 2018.
edited Mar 15 at 15:19
answered Mar 15 at 13:38
Jeff Schaller
31.2k846105
31.2k846105
Nice, this works very well. The only problem I found is the installer.profile which is not removed if the real installer is interrupted by ctrl+c.
â Patrick
Mar 15 at 15:05
Glad to hear that it works, @P.Jksch! I've added a line to remove the installer.profile intermediate file if the user hits Control-C.
â Jeff Schaller
Mar 15 at 15:20
add a comment |Â
Nice, this works very well. The only problem I found is the installer.profile which is not removed if the real installer is interrupted by ctrl+c.
â Patrick
Mar 15 at 15:05
Glad to hear that it works, @P.Jksch! I've added a line to remove the installer.profile intermediate file if the user hits Control-C.
â Jeff Schaller
Mar 15 at 15:20
Nice, this works very well. The only problem I found is the installer.profile which is not removed if the real installer is interrupted by ctrl+c.
â Patrick
Mar 15 at 15:05
Nice, this works very well. The only problem I found is the installer.profile which is not removed if the real installer is interrupted by ctrl+c.
â Patrick
Mar 15 at 15:05
Glad to hear that it works, @P.Jksch! I've added a line to remove the installer.profile intermediate file if the user hits Control-C.
â Jeff Schaller
Mar 15 at 15:20
Glad to hear that it works, @P.Jksch! I've added a line to remove the installer.profile intermediate file if the user hits Control-C.
â Jeff Schaller
Mar 15 at 15:20
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f430389%2fusing-script-command-for-installation-script-on-aix%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password