LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Puppy (https://www.linuxquestions.org/questions/puppy-71/)
-   -   Script does not work when place in Startup directory (https://www.linuxquestions.org/questions/puppy-71/script-does-not-work-when-place-in-startup-directory-4175530939/)

Fixit7 01-13-2015 06:28 PM

Script does not work when place in Startup directory
 
I have this in my Startup directory, but it never starts.

Anyone know why ?

Script works fine from a console.

#!/bin/bash
#
#
#
#
/usr/bin/seamonkey

schneidz 01-13-2015 06:29 PM

i usually put startup commands in my ~/.bash_profile or ~/.profile.

astrogeek 01-13-2015 06:40 PM

A better place might be to include that in your ~/.xinitrc or your DE's startup script (ex: ~/.fluxbox/startup). That way it is explicitly tied to your current X session.

Fixit7 01-13-2015 07:02 PM

I put the command in .profile but it does not start seamonkey.

Quote:

#120221 moved this code here from /etc/profile, also take 'exec' prefix off call to xwin.

if [ ! -f /usr/bin/X ];then
#v2.00r1 now support a text-mode-only puppy...
if [ -f /usr/local/bin/elinks ];then
if [ ! -f /tmp/bootcnt.txt ];then
touch /tmp/bootcnt.txt
#exec /usr/local/bin/elinks file:///usr/share/doc/index.html
#/usr/local/bin/elinks file:///usr/share/doc/index.html & #110804 110807
/usr/local/bin/elinks file:///usr/share/doc/index.html
fi
else
echo
echo "\\033[1;31mSorry, cannot start X. Link /usr/bin/X missing."
echo -n "(suggestion: type 'xorgwizard' to run the Xorg Video Wizard)"
echo -e "\\033[0;39m"
fi
else
if [ -f /root/.xorgwizard-reenter ];then #130423 see /usr/sbin/xorgwizard-cli 130513 also see init (in initrd)
xorgwizard-cli
fi

/usr/bin/seamonkey

#want to go straight into X on bootup only...
if [ ! -f /tmp/bootcnt.txt ];then
touch /tmp/bootcnt.txt
# aplay -N /usr/share/audio/bark.au
dmesg > /tmp/bootkernel.log
#exec xwin
#xwin & #110804 110807
xwin
fi
fi

astrogeek 01-13-2015 08:58 PM

Quote:

Originally Posted by Fixit7 (Post 5300541)
I put the command in .profile but it does not start seamonkey.

I will not comment on the code that you posted, as I am not sure I understand how or why you did it that way.

But it is entirely possible that your ~/.profile file is not being executed.

Do you have a ~/.bash_profile file? If so, from man bash...

Code:

INVOCATION
      A login shell is one whose first character of argument zero is a -, or  one  started  with  the  --login
      option.

      An  interactive  shell is one started without non-option arguments and without the -c option whose stan‐
      dard input and error are both connected to terminals (as determined by isatty(3)), or one  started  with
      the  -i  option.  PS1  is  set  and  $- includes i if bash is interactive, allowing a shell script or a
      startup file to test this state.

      The following paragraphs describe how bash executes its startup files.  If any of the  files  exist  but
      cannot  be read, bash reports an error.  Tildes are expanded in filenames as described below under Tilde
      Expansion in the EXPANSION section.

      When bash is invoked as an interactive login shell, or as  a  non-interactive  shell  with  the  --login
      option,  it  first  reads  and executes commands from the file /etc/profile, if that file exists.  After
      reading that file, it looks for ~/.bash_profile, ~/.bash_login, and ~/.profile, in that order, and reads
      and  executes  commands  from  the first one that exists and is readable.
  The --noprofile option may be
      used when the shell is started to inhibit this behavior.

You will also need to background seamonkey for the startup script to continue.

Fixit7 01-13-2015 11:27 PM

I forgot to do this with my script. :-)

chmod +x *.sh

Is the reason that .sh files are not executable by default for security reasons ?

I know that scripts can wipe out the O.S. rather easily as I have often found out.

Thank God for backups. :-)

astrogeek 01-14-2015 12:50 AM

Quote:

Originally Posted by Fixit7 (Post 5300600)
Is the reason that .sh files are not executable by default for security reasons ?

Under *nix, the filename extension has no relevance to whether it is executable or not, only the executable bits matter.

A .txt file can be made executable, and a .sh file can be made non-executable, filename extension has no part in determining the executable status.

So, they are not executable by default for the reason that any newly created text file is not executable - because there is no reason for it to be! In that respect it is a safety, or security, default.

If it is a script that should be executable, you must set the executable bit without regard to extension.

Hope that helps!

Fixit7 01-14-2015 01:52 AM

Vielen Dank Astrogeek.

Are you trying to obfuscate your signature ? :-)

Quote:

Distribution: Slackware [64]X{.0|.1|.2|-current} ::X>=12<=14, FreeBSD_10{.0|.1}

astrogeek 01-14-2015 02:18 AM

Пожалуйста Fixit7!

It was supposed to be clever, but obfuscated is good enough! ;)

Something done as a distraction. Actually, it isn't even correct, been meaning to fix that!

Fixit7 01-14-2015 02:59 AM

Is this Russian or more cleverness ??

Пожалуйста Fixit7!

astrogeek 01-14-2015 12:46 PM

Quote:

Originally Posted by Fixit7 (Post 5300661)
Is this Russian or more cleverness ??

Пожалуйста Fixit7!

Yes, Russian. I had to google translate the German, and would have had to reverse translate my response, so instead I gave you something to translate... and gave myself an excuse to use my recently learned Russian...

Пока!


All times are GMT -5. The time now is 10:54 PM.