This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

  • Answer Suggested

Linux/PROCESSOR-SDK-AM335X: init script not working in /etc/init.d

Intellectual 965 points

Replies: 15

Views: 8553

Part Number: PROCESSOR-SDK-AM335X

Tool/software: Linux

Hi,

I'm working on latest ti sdk ti-processor-sdk-linux-am335x-evm-03.02.00.05-Linux-x86-Install. I'm using filesystem "arago-base-tisdk-image-am335x-evm". I wanted to put init script in /etc/init.d and referred the below ti document.

vi /etc/init.d/helloworld.sh

#!/bin/sh

case $1 in

start )
echo ""
echo "Hello from Sitara!!!"
echo ""
 ;;
stop )
echo ""
echo "Goodbye from Sitara :("
echo ""
 ;;
* )
echo "$0: unknown option passed"
 ;;

esac

I'm are not getting any logs like "Hello from Sitara!!! " and "Goodbye from Sitara :".

Below are the screen shots of logs.

Though services are getting start and stop for helloworld script but logs from script are not coming.

Thanks and Regards,

Deshvir Malik

  • Hi,

    Processor SDK has moved from SystemV module to systemD. Please explore the option of running script from systemD. No longer rcS based initializing is done.

    Thanks and Regards,

    Dwarakesh R.

    Link: PathPartner Technology

  • In reply to Dwarakesh R:

    Hi Dwarakesh,

    Thanks for the info.
    Do you have any document to refer? I checked again and found that all the default init scripts are in init.d and systemD consist of config files.

    Thanks and Regards,
    Deshvir Malik
  • In reply to Deshvir Malik:

    Hi Deshvir,

    Please refer another e2e post with similar query as yours and the steps to do it: e2e.ti.com/.../539060

    Thanks and Regards,

    Dwarakesh R.

    Link: PathPartner Technology

  • In reply to Dwarakesh R:

    Hi Dwarakesh,

    I tried exactly the same steps as mentioned in the link provided by you but still didn't get any logs on console.

    This is what I tried

     vi /lib/systemd/system/myinit.service

    [Unit]
    Description=My init scripts

    [Service]
    ExecStart=/etc/init.d/myinitscript.sh
    StandardOutput=journal+console

    [Install]
    WantedBy=multi-user.target

    vi /etc/init.d/myinitscript.sh

    #!/bin/sh
    echo ""
    echo "Hello from Sitara!!!"
    echo ""

    Could you suggest what might be the problem?

    Thanks and Regards

    Deshvir Malik

  • In reply to Deshvir Malik:

    Hi,

    Can you try renaming the systemd service as myinitscript.service ?

    Thanks and Regards,

    Dwarakesh R.

    Link: PathPartner Technology

  • In reply to Dwarakesh R:

    Hi,

    I tried renaming. That's also not working.

    Thanks,
    Deshvir Malik
  • In reply to Deshvir Malik:

    In that case, I would suggest couple of things to confirm if script is running.
    1. Can you create a file from your script at a known location
    2. Can you create a dependency on a daemon and run the script later in time.

    I am thinking since systemD runs services in parallel, may be your script is run way ahead, before even terminal is ready.

    Thanks and Regards,

    Dwarakesh R.

    Link: PathPartner Technology

  • In reply to Dwarakesh R:

    Hi,

    1. I tried your first solution by modifying the script to create a file

    I added this line to create a file create.txt

    echo > /home/root/create.txt

    but create.txt not created.

    2. I'm not getting how 2nd solution can be implemented.  How to create dependency on daemon?

    Thanks and Regards,

    Deshvir Malik

  • In reply to Deshvir Malik:

    Hi Deshvir,

    Would suggest to check the status of the service
    # systemctl status myinit.service
    Also would suggest you to manually start like
    # systemctl start myinit.service

    Thanks and Regards,

    Dwarakesh R.

    Link: PathPartner Technology

  • In reply to Dwarakesh R:

    Hi,

    Via provided commands, service started working. But why its not automatically working at boot up?

    Below are the logs:

    root@am335x-evm:/etc/init.d# systemctl status myfirstscript.service

    ��● myfirstscript.service - My init scripts

    Loaded: loaded (/lib/systemd/system/myfirstscript.service; disabled; vendor preset: enabled)

      Active: inactive (dead)

    root@am335x-evm:/etc/init.d# systemctl start myfirstscript.service                                                                            

    root@am335x-evm:/etc/init.d# [  139.698647] myfirstscript.sh[668]: Hello from Sitara!!!

    root@am335x-evm:/etc/init.d# systemctl status myfirstscript.service

    root@am335x-evm:/etc/init.d#

    ��● myfirstscript.service - My init scripts

      Loaded: loaded (/lib/systemd/system/myfirstscript.service; disabled; vendor preset: enabled)

      Active: inactive (dead)

    Dec 14 23:17:25 am335x-evm systemd[1]: Started My init scripts.

    Dec 14 23:17:25 am335x-evm myfirstscript.sh[668]: Hello from Sitara!!!

    Thanks and\ Regards,

    Deshvir Malik

This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.