Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
proview
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Esteban Blanc
proview
Commits
0a15059e
Commit
0a15059e
authored
Nov 10, 2008
by
claes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
*** empty log message ***
parent
c84b8ba6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
112 additions
and
76 deletions
+112
-76
src/tools/pkg/rpm/pwrrt/pwr
src/tools/pkg/rpm/pwrrt/pwr
+112
-76
No files found.
src/tools/pkg/rpm/pwrrt/pwr
View file @
0a15059e
#!/bin/bash
#!/bin/bash
#
#
# Startscript fr PWR
av Ulf Ljungdahl
# Startscript fr PWR
#
#
PATH
=
/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
PATH
=
/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
wrapper
=
"/tmp/rt_ini_wrapper"
killer
=
"/tmp/pwr_killer"
.
/etc/pwrp_profile
.
/etc/pwrp_profile
umask
002
create_wrapper
()
pwr_start
()
{
{
$pwr_exe
/rt_ini &
if
[
!
-e
$wrapper
]
;
then
echo
"#!/bin/bash"
>
$wrapper
echo
"source /etc/pwrp_profile"
>>
$wrapper
echo
"umask 002"
>>
$wrapper
echo
"
\$
pwr_exe/rt_ini
\$
* &"
>>
$wrapper
chmod
a+rx
$wrapper
if
[
!
-e
$wrapper
]
;
then
echo
"
$wrapper
not writable, check permissions"
exit
fi
fi
}
}
pwr_stop
()
create_killer
()
{
{
rt_ini
-s
echo
"#!/bin/bash"
>
$killer
sleep
5
echo
"source /etc/pwrp_profile"
>>
$killer
kill
-9
`
ps ax |
grep
"rt_neth_acp"
|
awk
'{ print $1}'
`
echo
"umask 002"
>>
$killer
kill
-9
`
ps ax |
grep
"rt_neth"
|
awk
'{ print $1}'
`
kill
-9
`
ps ax |
grep
"rt_qmon"
|
awk
'{ print $1}'
`
echo
"
`
ps ax |
grep
"rt_"
|
awk
'{ print "kill -9 "$1}'
`
"
>>
$killer
kill
-9
`
ps ax |
grep
"rt_emon"
|
awk
'{ print $1}'
`
echo
"
`
ps ax |
grep
"rs_"
|
awk
'{ print "kill -9 "$1}'
`
"
>>
$killer
kill
-9
`
ps ax |
grep
"rt_tmon"
|
awk
'{ print $1}'
`
echo
"
`
ps ax |
grep
"ra_"
|
awk
'{ print "kill -9 "$1}'
`
"
>>
$killer
kill
-9
`
ps ax |
grep
"rt_
\|
/pwr/exe/rs"
|
awk
'{ print $1}'
`
echo
"
`
ps ax |
grep
"sev_"
|
awk
'{ print "kill -9 "$1}'
`
"
>>
$killer
kill
-9
`
ps ax |
grep
"
\[
rt_"
|
awk
'{ print $1}'
`
echo
"
`
ps ax |
grep
"opc_"
|
awk
'{ print "kill -9 "$1}'
`
"
>>
$killer
kill
-9
`
ps ax |
grep
"plc_"
|
awk
'{ print $1}'
`
kill
-9
`
ps ax |
grep
"jpwr.rt"
|
awk
'{ print $1}'
`
kill
-9
`
ps ax |
grep
"rs_nmps"
|
awk
'{ print $1}'
`
kill
-9
`
ps ax |
grep
"rs_remote"
|
awk
'{ print $1}'
`
if
[
-u
$pwr_exe
/rt_ini
]
;
then
user
=
`
ls
-al
$pwr_exe
/rt_ini |
awk
'{ print $3}'
`
else
user
=
$USER
fi
echo
"User
$user
"
echo
"eval
`
ipcs
-s
|grep ^0x|grep
"[
\t
]pwrp[
\t
]"
|awk
'{printf "ipcrm sem %s;", $2}'
`
"
>>
$killer
echo
"eval
`
ipcs
-q
|grep ^0x|grep
"[
\t
]pwrp[
\t
]"
|awk
'{printf "ipcrm msg %s;", $2}'
`
"
>>
$killer
echo
"eval
`
ipcs
-m
|grep ^0x|grep
"[
\t
]pwrp[
\t
]"
|awk
'{printf "ipcrm shm %s;", $2}'
`
"
>>
$killer
echo
"rm /tmp/pwr*
\$
PWR_BUS_ID"
>>
$killer
chmod
a+rx
$killer
if
[
!
-e
$killer
]
;
then
echo
"
$killer
not writable, check permissions"
exit
fi
}
eval
`
ipcs
-s
|grep ^0x|grep
"[
\t
]
$user
[
\t
]"
|awk
'{printf "ipcrm sem %s;", $2
}'
`
# remove message queues
pwr_start
()
eval
`
ipcs
-q
|grep ^0x|grep
"[
\t
]
$user
[
\t
]"
|awk
'{printf "ipcrm msg %s;", $2
{
}'
`
create_wrapper
if
[
`
whoami
`
==
"pwrp"
]
;
then
$wrapper
else
sudo
-u
pwrp
$wrapper
fi
}
# remove shared memory
pwr_stop
()
eval
`
ipcs
-m
|grep ^0x|grep
"[
\t
]
$user
[
\t
]"
|awk
'{printf "ipcrm shm %s;", $2
{
}'
`
create_wrapper
if
[
`
whoami
`
==
"pwrp"
]
;
then
$wrapper
-s
if
[
-e
$pwrp_exe
/pwrp_stop.sh
]
;
then
source
$pwrp_exe
/pwrp_stop.sh
fi
else
sudo
-u
pwrp
$wrapper
-s
if
[
-e
$pwrp_exe
/pwrp_stop.sh
]
;
then
sudo
-u
pwrp
source
$pwrp_exe
/pwrp_stop.sh
fi
fi
while
[
"
`
ps aux |
grep
-v
grep
|
grep
rt_
`
"
!=
""
]
;
do
sleep
1
;
done
}
if
[
-e
$pwrp_exe
/pwrp_stop.sh
]
;
then
pwr_reload
()
source
$pwrp_exe
/pwrp_stop.sh
{
if
[
`
whoami
`
==
"pwrp"
]
;
then
$pwr_exe
/rt_ini_wrapper
-r
else
sudo
-u
pwrp
$pwr_exe
/rt_ini_wrapper
-r
fi
fi
}
rm
/tmp/pwr
*
$PWR_BUS_ID
pwr_kill
()
{
#rm -f /tmp/pwr*
create_killer
#id=`ipcs -s | grep $user | awk '{print $2}'`
if
[
`
whoami
`
==
"pwrp"
]
;
then
#id1=`echo $id | awk '{print $1}'`
$killer
#id2=`echo $id | awk '{print $2}'`
else
#id3=`echo $id | awk '{print $3}'`
sudo
-u
pwrp
$killer
#ipcrm sem $id1
fi
#ipcrm sem $id2
#ipcrm sem $id3
#id=`ipcs -q | grep $user | awk '{print $2}'`
#id1=`echo $id | awk '{print $1}'`
#id2=`echo $id | awk '{print $2}'`
#id3=`echo $id | awk '{print $3}'`
#ipcrm msg $id1
#ipcrm msg $id2
#ipcrm msg $id3
}
}
case
"
$1
"
case
"
$1
"
in
in
start
)
start
)
echo
"Startar PWR..."
echo
"Start Proview Runtime Environment."
#if [ 'test -x ps aux | grep plc | grep -v grep' ]
# then
# echo "PWR kr, stoppar det frst.."
# pwr_stop
# fi
pwr_start
pwr_start
echo
"
Klar
."
echo
"
Done
."
;;
;;
stop
)
stop
)
echo
"Stop
par PWR..
."
echo
"Stop
Proveiw Runtime Environment
."
pwr_stop
pwr_stop
echo
"Done."
# if [ "${SAVEONCE}" != "yes" ]
# then
# save
# echo -n "ipchains-save"
# else
# echo -n "Clearing IP chains:"
# fi
echo
"Klar"
;;
;;
restart
)
restart
)
echo
"
Startar om PWR
."
echo
"
Restart Proview Runtime Environment
."
echo
"
Stoppar det frst
."
echo
"
Closing down..
."
pwr_stop
pwr_stop
sleep
1
sleep
1
echo
"Start
ar igen
."
echo
"Start
ing..
."
pwr_start
pwr_start
echo
"Klar."
echo
"Done."
;;
reload
)
echo
"Reload Proview Runtime Environment"
pwr_reload
echo
"Done."
;;
kill
)
echo
"Remove all processes and resources for Proview Storage Environment"
pwr_kill
echo
"Done."
;;
reset
)
echo
"Remove all processes and resources for Proview Storage Environment"
pwr_kill
echo
"Done."
;;
;;
*
)
*
)
echo
"Usage:{start|stop|restart}"
>
&2
echo
" pwrsev Start and stop Proview Storage Environment"
>
&2
#echo "Ingen parameter angiven, startar PWR"
echo
""
>
&2
#$0 start
echo
" Usage:"
>
&2
echo
" pwr start|stop|restart|reload|reset"
>
&2
echo
""
>
&2
echo
" start Start Runtime environment"
>
&2
echo
" stop Stop Runtime environment"
>
&2
echo
" restart First stop and then start Runtime environment"
>
&2
echo
" reload Soft restart of Runtime environment"
>
&2
echo
" reset Remove all processes and resources"
>
&2
echo
""
>
&2
exit
1
exit
1
;;
;;
esac
esac
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment