[SOLVED] Entertainment center automation?

Questions about applications and software
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
drksam

[SOLVED] Entertainment center automation?

Post by drksam »

Hi everyone. I am playing with an idea to make a piece of hardware (probably an arduino based thing) that will be connected to a pc running mint and will turn on and off entertainment center parts such as amps so that I don't get a pop out of the speakers when the computer comes on and off.

I know quite a bit about arduino and have already made a sketch that turns a pin on or off from a serial H or L. This works great for controlling the hardware and I can get it to work using echo -e -n 'H' > /dev/tty/USB or echo -e -n 'L' > /dev/tty/USB0. I wrote a little script and set it as executable and it works fine.

So now all I should have to do is get the computer to run the script right after boot up and right before shutdown. I have looked around and found some info about setting this up using rc0.d and rc6.d as well as a method using systemd. I have tried both methods (only for shutdown) but have had no luck getting it to send the command.

So my questions are
1. Is it that by the time my script is running the serial is already disabled?
2. Anyone have any other ideas to do the same thing?

Thanks for any help
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 2 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
User avatar
AndyMH
Level 21
Level 21
Posts: 13736
Joined: Fri Mar 04, 2016 5:23 pm
Location: Wiltshire

Re: Entertainment center automation?

Post by AndyMH »

I had something similar in that I wanted to run a script (to do a backup) on shutdown, googled how to do it and in the end decided not to mess with systemd - think it could be quite easy to bork your system. It would also appear that you can't control the order in which the processes (or your script) shut down. In my case, my backup drive may be unmounted before my backup script runs.

In the end, I changed my backup script to shut down the system on completion and added it to the menu - much simpler. Want to run something on startup - add it to 'startup applications', but again, I've no idea in what order the processes start up.
Thinkcentre M720Q - LM21.3 cinnamon, 4 x T430 - LM21.3 cinnamon, Homebrew desktop i5-8400+GTX1080 Cinnamon 19.0
drksam

Re: Entertainment center automation?

Post by drksam »

Thanks for the reply.

I have done some more messing with it and I am satisfied that it should be possible so I've set up a test computer that I'm not worried about messing up. I have played with systemd a little and kinda understand what's going on but am unsure of where to insert my script to make it send the echo before everything else starts to shutdown. Also I'm not sure if my script is correctly formated to be used by systemd, it does work fine if I click it but is that good enough?
drksam

Re: Entertainment center automation?

Post by drksam »

Ok so i figured it out. I did use systemd and bash scripts to control an arduino uno. The current setup is working great so I thought I would post my files here. Maybe they will help someone.
Locked

Return to “Software & Applications”