WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Script issue in tc-config  (Read 1988 times)

Offline AlejandroPadrino

  • Full Member
  • ***
  • Posts: 143
Script issue in tc-config
« on: June 29, 2023, 07:03:05 AM »
Hello, I maded a little script to execute a second script file wich name is stored into a variable, like next:

xFile=/mnt/sda1/myfolder/myscript.sh
if [ -f "$xFile" ]; then command $xFile ; fi;

This script really is some complex because depends by other variables.  The script runs fine in ash command shell, but it did not run into tc-config file.  Why?

Into tc-config file I runned fine other executed scripts, like alsa startup.  But this code only recognizes variable values and checking for files.  Into tc-config it did not launch the $xFile script.  /dev/sda1 hard disk is mounted successfully in tc-config file before calling the script.

Thank you.  :-)

Offline Paul_123

  • Administrator
  • Hero Member
  • *****
  • Posts: 1268
Re: Script issue in tc-config
« Reply #1 on: June 30, 2023, 12:58:09 PM »
tc-config is part of the initrd.   If you need to make changes to tc-config, you will need to remaster your initrd.  You cannot edit the file and add to .filetool.sh.

Why not just run your script in bootlocal.sh?

Offline AlejandroPadrino

  • Full Member
  • ***
  • Posts: 143
Re: Script issue in tc-config
« Reply #2 on: July 01, 2023, 08:59:50 AM »
I know.  My current core remaster is 341mb in size.  :-)

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11703
Re: Script issue in tc-config
« Reply #3 on: July 01, 2023, 09:42:33 AM »
Hi AlejandroPadrino
... The script runs fine in ash command shell, but it did not run into tc-config file.  Why? ...
It did not run, or you did not see the result you expected?
Those are 2 different issues that could show the same symptoms.

You need to add some debugging code to find out what's happening.
Change your tc-config to this:
Code: [Select]
xFile=/mnt/sda1/myfolder/myscript.sh
if [ -f "$xFile" ]; then echo "xFile=$xFile" > /tmp/xFile.log ; fi;
if [ -f "$xFile" ]; then command $xFile ; fi;

Then add this to myscript.sh:
Code: [Select]
echo "myscript.sh started" >> /tmp/xFile.log
echo "Environmental variables:" >> /tmp/xFile.log
env >> /tmp/xFile.log

Check that the log file exists.
Check that the variables you need are listed in the log file.
Check the PATH variable in the log file. Make sure:
    1. It includes paths you assume to be defined are included.
    2. Make sure the order of the paths matches what you expect.

Offline AlejandroPadrino

  • Full Member
  • ***
  • Posts: 143
Re: Script issue in tc-config
« Reply #4 on: July 01, 2023, 07:04:19 PM »
Solved ... and sorry.

I don't expect that myscript.sh file was copy to NTFS partition /mnt/sda1/myfolder with root user and group.  changed to tc:staff runs fine.

Thank you.  :-)