Running user programs on startup

Go To Last Post
8 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello--

Before deploying one of my new AVR32 AP7001 systems, I added a script to the /etc/init.d directory to run another script situated in a root directory /programs. Here is the basic code of the script (named S60startup)

#!/bin/sh

cd /programs
sh /programs/startup.sh

I then used chmod on the script to make it executable:

chmod +x ./S60startup

The startup.sh script sets up the system and runs a userland program to provide system functionality.

However, I've found that it is now impossible to terminate the userland program using Ctrl-C.

What is the recommended way to run a program on startup so that I can later terminate the program?

Is it now possible to terminate the userland program at all? What would be the best way to proceed?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You could run "top" and kill the program through that...after you run top hit "h" to see the help menu

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello saschaefer--

Many thanks for your reply. I tried typing "top" but unfortunately I do not have a command-line prompt. It seems that I am "jailed" into my userland program.

Is there any way to run top without exiting my userland program?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

put an "&" (ampersand) after your command to run your userland program, that will run your program in the background and still give you access to the command-line

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Ctrl + z will suspend the application.

Hans-Christian

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

saschaefer and hce: Thank you for your suggestions!

I tried sending the Ctrl + z suspend signal while running my userland program and usually this should show a "[1] + Stopped" prompt, but nothing is displayed on the terminal but a "^Z" symbol. For some strange reason it does not seem that the SIGTSTP signal is being sent to the foreground userland process.

Is there a way to exit from the init.d startup scripts and get into a command prompt before my userland program is started as a foreground process?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You could skip init passing init=/bin/bash to the kernel. Then none of the scripts will be executed and it should give you a shell.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

saschaefer,hce and Correa: Thank you so much for your help!

For my system with linux-2.6.27.6 kernel, I had to add init=/bin/sh to the Uboot bootargs parameter. Then the startup scripts were not executed, and I was once again dropped back into a prompt. I then deleted my startup script.

Many thanks for guiding me in the right direction :-)