- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Progress Bar using shell script
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-22-2010 09:37 AM
тАО09-22-2010 09:37 AM
I have made a script to etact diskinformation using sympd list it usually takes 3-8 Mins depaing on disks & array size.
I want my script should display some progress bar like in Windows.is it possible to implement.
Thanks in advance.
Regards
Ankit
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-22-2010 10:00 AM
тАО09-22-2010 10:00 AM
Re: Progress Bar using shell script
One way to create a progress bar (dots, a spinning widget, etc.) in a shell script, is to build a function that paints the bar with small sleep intervals between each point. Launch this piece as a background task and capture its pid in a variable, like: TIMER=$!. Start your real work and when that's done, kill the background process that you first started (with 'kill ${TIMER}').
If you prefer, you can do your real work as a background process and let your progress bar or widget spin as a foreground task.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-22-2010 11:08 AM
тАО09-22-2010 11:08 AM
Re: Progress Bar using shell script
Below is my script.
"EMC") echo "its OK"
ssh $srv /usr/symcli/bin/sympd list>/tmp/lun
echo "This is EMC"
echo "So we are extracting LUN ID'S"
while read inputline
do
lun=`cat /tmp/lun|grep $inputline|tr -s " "|cut -d " " -f2`
echo $lun>>disk_lun
echo $lun
done
Can you bit explain as am running the command using ssh on another server so it will long to track the pid.
can we do time run until we get the control from ssh command.
Regards
Ankit
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-22-2010 11:41 AM
тАО09-22-2010 11:41 AM
SolutionHere's an example:
# cat ./monitor
#!/usr/bin/sh
function show_progress
{
while true
do
echo ".\c";
sleep 1
done
}
function do_work
{
echo "...doing work\c"
sleep 15
echo "done!"
}
show_progress &
TIMER=$!
do_work
kill ${TIMER}
sleep 1
exit 0
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-22-2010 03:22 PM
тАО09-22-2010 03:22 PM
Re: Progress Bar using shell script
Thanks for your reply.
I understand your script.Can you tell me if run the below command this command executes around 10-15 Mins.
ssh eux290 -n /usr/symcli/bin/sympd list>/tmp/ankit
So on that time i want to display the time.
so how woild i do that ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-22-2010 03:59 PM
тАО09-22-2010 03:59 PM
Re: Progress Bar using shell script
> I understand your script.Can you tell me if run the below command this command executes around 10-15 Mins.
> ssh eux290 -n /usr/symcli/bin/sympd list>/tmp/ankit
> So on that time i want to display the time.
If you want to report the elapsed number of seconds, you can do:
...
T0=${SECONDS}
ssh eux290 -n /usr/symcli/bin/sympd list>/tmp/ankit
echo "elapsed time = $((${SECONDS}-${T0})) seconds"
...
Regards!
...JRF...