Auto start files on startup

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

Threaded View
Hi guys,

I want to autostart one file(a .cs file) when i start my raspberry pi. Can any of you have an idea how it can be done?

Re: Auto start files on startup
On 2017-10-18, Pradeep Shanmugam wrote:
Quoted text here. Click to load it

What's a ".cs" file? What do it do, what purpose hav it?

(This will lead towards the answer to your question.)

Re: Auto start files on startup
On Wed, 18 Oct 2017 05:24:49 -0700 (PDT)

Quoted text here. Click to load it

AIUI a .cs file is C# source, so you'd need to compile it first.
At what point during the boot sequence do you want it to run?


Re: Auto start files on startup
On Wednesday, 18 October 2017 14:53:08 UTC+2, Rob Morley  wrote:
Quoted text here. Click to load it

Hi,

Thank you for the reply. I want it to run after the start(when it lands on the home screen)

Re: Auto start files on startup
On 2017-10-18, Pradeep Shanmugam wrote:
Quoted text here. Click to load it

(step 1) compile it to an executable, which you'll need to do to make
sure it's working anyway

(step 2) add the path to the executable as a distinct line at the end
of ~/.xsession (create that file if it doesn't exist).

Re: Auto start files on startup
On 18/10/2017 13:57, Pradeep Shanmugam wrote:
Quoted text here. Click to load it

C# would need to built against a viable a .Net framework like .Net Core.  
Which would also need to be installed on the Pi.

It isn't something I would expect someone who doesn't know what a .cs  
file is to be doing.

I think it would be sensible to give a little bit more information as to  
what the file is and what it is intended to do.

To see if it is C# you should look at it in a text editor and see if it  
looks like a C# code example.


Re: Auto start files on startup
On 10/18/17 05:53, Rob Morley wrote:
Quoted text here. Click to load it

oh, crap... that probably means WINDOWS, too.

and here I was going to recommend editing the rc.local file

(with the assumption that your Raspbian OS doesn't have systemd, or at  
least recognizes /etc/rc.local like the older Raspian did)


--  
your story is so touching, but it sounds just like a lie
"Straighten up and fly right"

Re: Auto start files on startup
On Sun, 22 Oct 2017 23:44:42 -0700

Quoted text here. Click to load it
He never responded to that particular point, or indeed to any of the
other responses to his initial post.  Maybe it was C shell not C#, who
knows?


Re: Auto start files on startup
Quoted text here. Click to load it

C# runs on Linux too.

--  
https://www.greenend.org.uk/rjk/

Re: Auto start files on startup
On Wednesday, October 18, 2017 at 8:24:50 AM UTC-4, Pradeep Shanmugam wrote:
Quoted text here. Click to load it

One way is this:
Open up /home/pi/.config/lxsession/LXDE-pi/autostart

At the end, add @path_to_your_file

I have a python program that starts like this in autostart:
@python /var/www/sensor/read.py

Re: Auto start files on startup
On Wednesday, October 18, 2017 at 8:24:50 AM UTC-4, Pradeep Shanmugam wrote:
Quoted text here. Click to load it

On a laptop, I use Visual Studio to compile C# to a .exe file, then move it to the Pi.
On the Pi, install and use Mono to run the .exe file

Re: Auto start files on startup
On Wed, 18 Oct 2017 05:24:49 -0700, Pradeep Shanmugam wrote:

Quoted text here. Click to load it

Editing the file /etc/rc.local to contain your command is another way.  
This is independent of any user login.

Re: Auto start files on startup
On 10/18/17 14:52, Mel Wilson wrote:
Quoted text here. Click to load it

does that still work with the newer Raspbian (with systemd in it, as far  
as I can tell)?  [I refuse to install anything with systemd on an RPi]

Hopefully it does and I'll hate systemd a little less knowing that.


--  
your story is so touching, but it sounds just like a lie
"Straighten up and fly right"

Re: Auto start files on startup
On Sun, 22 Oct 2017 23:47:39 -0700, Big Bad Bob wrote:

Quoted text here. Click to load it

Doesn't much matter. Its easy enough to write your own service definition  
and then enable it (so it starts at boot time).


--  
martin@   | Martin Gregorie
gregorie. | Essex, UK
We've slightly trimmed the long signature. Click to see the full one.
Re: Auto start files on startup
On Wednesday, October 18, 2017 at 8:24:50 AM UTC-4, Pradeep Shanmugam wrote:
Quoted text here. Click to load it

Did you get it to autostart?

Re: Auto start files on startup
snipped-for-privacy@gmail.com says...
Quoted text here. Click to load it

Another way (not mentioned yet, I think) of getting stuff to start on  
boot is to add an

@reboot <command>

line to your crontab.

--  
John


Re: Auto start files on startup
On Mon, 23 Oct 2017 14:32:59 +0100, John Aldridge wrote:

Quoted text here. Click to load it

I don't think this is what the OP wants. He said "I want it to run after  
the start(when it lands on the home screen)" which sounds to me as though  
he wants his program C# program to be started when he logs in to his RPi  
and to stop when he logs out.  

So, I think a better arrangement would be to add the startup command  
to .bashrc as its last line and should put a stop command, e.g. "killall  
progname", as the first command in .bash_logout

This needs to be done on all the logins where his program should be  
running while he's logged in.


--  
martin@   | Martin Gregorie
gregorie. | Essex, UK
We've slightly trimmed the long signature. Click to see the full one.

Site Timeline