You are not logged in.

#1 2022-02-04 04:26:50

Antdoid
Member
Registered: 2022-02-04
Posts: 1

Running a script at startup

I'm not sure if this is considered general usage or not, but still. I've tried every tutorial on the internet to make arch run the shell script. I've tried adding it to ~/.xinitrc, it wouldn't run. I have the script made to where it will automatically run a python script, which needs to be ran in the same directory as every other file. I tried to make a systemd service to run the script but it refused to run at all. Systemctl status didn't tell me shit either. Can someone please help me I'm slowly diving into insanity by this simple topic. If it wasn't obvious before, I'm new to arch.

Offline

#2 2022-02-04 04:42:26

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,426
Website

Re: Running a script at startup

Start by telling us more about the script: what does it do? Does it require a graphical environment? Sharing it would simplify things.

Then tell us what you mean by "start up". On booting? Log in to a DE/WM (which one) or a TTY? If you added it to .xinitrc we can infer that it is when you log into an X session, but we'd prefer to know exactly what you are trying to accomplish.


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#3 2022-02-04 14:06:28

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,492
Website

Re: Running a script at startup

Antdoid wrote:

Systemctl status didn't tell me shit either.

It certainly told you something.  You may not have been able to understand what it told you, but we could ... if you shared it.  Did systemctl reply with the following:

Unit <whatever>.service could not be found.

I believe that is the only output from systemctl that would fit your conclusion that it didn't run at all.  I suspect it's more likely that the service did run, but it didn't achieve what you hoped.

Last edited by Trilby (2022-02-04 14:07:09)


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#4 2022-02-04 17:21:03

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 20,690

Re: Running a script at startup

What are you trying to do, and what do you mean by running at startup?   Putting it in .xinitrc means it waits until you user logs in and starts Xorg.


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
The shortest way to ruin a country is to give power to demagogues.— Dionysius of Halicarnassus
---
How to Ask Questions the Smart Way

Offline

#5 2022-02-04 18:18:59

Morn
Member
Registered: 2012-09-02
Posts: 886

Re: Running a script at startup

This thread is a great example for why some of us are still using /etc/rc.local and rc-local.service. smile

Offline

#6 2022-02-04 19:06:57

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 20,690

Re: Running a script at startup

Morn wrote:

This thread is a great example for why some of us are still using /etc/rc.local and rc-local.service. smile

And I still own 2 slide rules and a pair of 12 inch vernier calipers.


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
The shortest way to ruin a country is to give power to demagogues.— Dionysius of Halicarnassus
---
How to Ask Questions the Smart Way

Offline

#7 2022-02-04 19:44:53

Morn
Member
Registered: 2012-09-02
Posts: 886

Re: Running a script at startup

ewaller wrote:
Morn wrote:

This thread is a great example for why some of us are still using /etc/rc.local and rc-local.service. smile

And I still own 2 slide rules and a pair of 12 inch vernier calipers.

On Arch, you sometimes need a place to put temporary workarounds. E.g. remember when there was an issue with USB autosuspend disabling devices a few years ago? The workaround went into my rc.local. No point in creating a systemd service for something that is only needed for only a few weeks until the fix arrives. And where do I put my "setterm -blank 0 -powerdown 0"? Same place.

The only problem with rc.local is that you easily can forget what's in it. But in mine, almost all lines are commented out anyway, so it is not a major source of buggy non-standard system behavior.

Offline

#8 2022-02-04 20:12:09

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 77,087

Re: Running a script at startup

We don't even know the context of the desired startup script - rc.d won't help if it's a user/session script.
The thread is rather a great example why https://bbs.archlinux.org/viewtopic.php?id=57855 is a sticky...

Offline

#9 2022-02-04 20:20:36

Morn
Member
Registered: 2012-09-02
Posts: 886

Re: Running a script at startup

seth wrote:

We don't even know the context of the desired startup script - rc.d won't help if it's a user/session script.

The OP has not been heard from again so far after his initial, extremely vague post. I think it's not unusual for the forum discussion to become a bit more general without further information. The lurkers want to learn something too, even if the OP loses interest…

Offline

#10 2022-02-04 20:23:11

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,492
Website

Re: Running a script at startup

Morn wrote:

The OP has not been heard from again so far after

So far after?!  It's been 16 hours.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

Board footer

Powered by FluxBB