WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Issues with starting and stopping gpm via init.d  (Read 3078 times)

Offline SamK

  • Hero Member
  • *****
  • Posts: 713
Issues with starting and stopping gpm via init.d
« on: July 26, 2013, 05:33:25 AM »
TC: v4.7.5
gpm: OnBoot (default configuration used)

Following a reboot, commands run as root


Obtain status of gpm
Code: [Select]
ps | grep gpm
... root     grep gpm
gpm is not running.


Start gpm via init.d
Code: [Select]
/usr/local/etc/init.d/gpm start
gpm is already running


ps | grep gpm
... root     grep gpm
Expected message, "Starting gpm."
gpm is not running.


Start gpm at the command line using standard configuration
Code: [Select]
gpm -m /dev/input/mice -t ps2


ps | grep gpm
... root     gpm -m /dev/input/mice -t ps2
... root     grep gpm
gpm is running


Kill the X-server and load Midnight Commander. 
Mouse works as expected.


Stop gpm via init.d
Code: [Select]
/usr/local/etc/init.d/gpm stop
Killed


ps | grep gpm
... root     grep gpm
gpm successfully stopped.


Again stop gpm via init.d
Code: [Select]
/usr/local/etc/init.d/gpm stop
Killed
Expected message, "gpm was not running, no process killed."



Edit: added expected message
« Last Edit: July 27, 2013, 01:44:23 AM by SamK »

Offline famousbirds

  • Newbie
  • *
  • Posts: 2
Re: Issues with starting and stopping gpm via init.d
« Reply #1 on: December 10, 2014, 06:58:22 PM »
Resurrecting this one since I have experienced this issue and have a fix:

The init.d/gpm script is broken on lines 9 and 27.

Currently it reads:

Code: (bash) [Select]
if ps | awk '{print $3}' | grep -e "gpm" >/dev/null; then

This is incorrect, since the script is also called "gpm"!  So it will find its own entry and abort.

Instead, the code should read:

Code: (bash) [Select]
if ps | awk '{print $3}' | grep -e "/usr/local/sbin/gpm" >/dev/null; then

This will ensure searching for current gpm processes identifies the actual gpm executable, not the init.d script.  This is in keeping with the many explicit references to /usr/local/sbin/gpm in the rest of the script.

Otherwise, gpm will never actually be started.  Spent a minute scratching my head over this one.

I am happy to submit this fix more formally - is posting in the forums the official method, or is there some place I can submit a pull request?

Thanks!

Offline Misalf

  • Hero Member
  • *****
  • Posts: 1702
Re: Issues with starting and stopping gpm via init.d
« Reply #2 on: December 10, 2014, 07:05:26 PM »
Aha! Thanks.

For submitting extensions see here:
http://wiki.tinycorelinux.net/wiki:creating_extensions#submission
Download a copy and keep it handy: Core book ;)

Offline famousbirds

  • Newbie
  • *
  • Posts: 2
Re: Issues with starting and stopping gpm via init.d
« Reply #3 on: December 10, 2014, 08:09:13 PM »
Ah thanks, submitted.

Offline Greg Erskine

  • Sr. Member
  • ****
  • Posts: 404
Re: Issues with starting and stopping gpm via init.d
« Reply #4 on: December 11, 2014, 01:09:36 AM »
Resurrecting this one since I have experienced this issue and have a fix:

The init.d/gpm script is broken on lines 9 and 27.

Currently it reads:

Code: (bash) [Select]
if ps | awk '{print $3}' | grep -e "gpm" >/dev/null; then

This is incorrect, since the script is also called "gpm"!  So it will find its own entry and abort.

Instead, the code should read:

Code: (bash) [Select]
if ps | awk '{print $3}' | grep -e "/usr/local/sbin/gpm" >/dev/null; then

This will ensure searching for current gpm processes identifies the actual gpm executable, not the init.d script.  This is in keeping with the many explicit references to /usr/local/sbin/gpm in the rest of the script.

Otherwise, gpm will never actually be started.  Spent a minute scratching my head over this one.

I am happy to submit this fix more formally - is posting in the forums the official method, or is there some place I can submit a pull request?

Thanks!

hi famousbirds,

I think I have solved a similar situation by adding "| grep -v grep |".

regards
Greg