WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Closing Plymouth slash screen  (Read 2492 times)

Offline mbertrand

  • Full Member
  • ***
  • Posts: 225
Closing Plymouth slash screen
« on: March 07, 2013, 11:31:40 AM »
At the end of the bootlocal.sh I'm starting my console app in the background
after that I'm calling "/bin/plymouth --quit" to shut down the splash screen. Is there a way to know after I start my app within a certain time out if my app has started. This would allow me to close the splash screen only when the app has started.

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11641
Re: Closing Plymouth slash screen
« Reply #1 on: March 07, 2013, 11:39:07 AM »
Hi mbertrand
Try:
Code: [Select]
ps | grep YourApplicationsName | grep -v grep

Offline mbertrand

  • Full Member
  • ***
  • Posts: 225
Re: Closing Plymouth slash screen
« Reply #2 on: March 07, 2013, 11:44:50 AM »
Thanks, but I'm kind of new to Linux. I would need to maybe loop until it has started for a max of x seconds before closing splash screen but I don't know how to loop in script file. I will Google!

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11641
Re: Closing Plymouth slash screen
« Reply #3 on: March 07, 2013, 12:51:13 PM »
Hi mbertrand
I think this might work:
Code: [Select]
#!/bin/sh

Timeout=10

until ps | grep YourApplicationsName | grep -v grep
do
sleep 1
let "Timeout -= 1"
[ $Timeout -le 0 ] && break
done
A brief explanation of what it does (or should do, did not test it):
The ps command returns a list of processes currently running. Once your app starts, it will be listed.
The first grep command searches for your apps name and the second grep command filters out results containing
the word grep, since running grep adds it to the list of processes.
The commands between  do  and  done  will execute  until  your app starts.
The variable Timeout  is decrement by one each time through the loop. When it hits zero, you drop out of the loop.
You can test  Timeout  later in your script to determine if your app started or you just timed out.
« Last Edit: March 07, 2013, 01:10:17 PM by Rich »

Offline mbertrand

  • Full Member
  • ***
  • Posts: 225
Re: Closing Plymouth slash screen
« Reply #4 on: March 07, 2013, 01:07:20 PM »
Thanks
I'm a C++ software developer so it's a question of knowing the syntax and now I'm finding out that BuzyBox does not have full implementation of sh and  it is 'ash" and not sh. Is this correct? Now I can't even find the right documentation!

I've tried your example and I'm getting:
sh: 0: unknown operand

and I'm in an infinite loop?



Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11641
Re: Closing Plymouth slash screen
« Reply #5 on: March 07, 2013, 01:13:26 PM »
Hi mbertrand
There was a typo in the line with the  break statement, corrected original post.
sh  is a link in  /bin  that points to the default shell, which is  busyboxs ash.

Offline mbertrand

  • Full Member
  • ***
  • Posts: 225
Re: Closing Plymouth slash screen
« Reply #6 on: March 07, 2013, 01:18:30 PM »
Thanks again.

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11641
Re: Closing Plymouth slash screen
« Reply #7 on: March 07, 2013, 01:37:53 PM »
Hi mbertrand
No problem. By the way, debugging a script is just like debugging any other program when no other tools are
available. Place a  #  sign on a line to comment it out to see if it's causing an error. Use  echo  to print out
variables to the screen.

Offline mbertrand

  • Full Member
  • ***
  • Posts: 225
Re: Closing Plymouth slash screen
« Reply #8 on: March 07, 2013, 01:44:29 PM »
Thanks