I can now execute a script on a server from my local computer without having to SSH into it.
13d 2h ago by piefed.social/u/djdarren in dull_mens_clubI'm not a programmer, and don't really know that much about these things, but I've got an equipment dashboard at work running on an old ThinkPad I found in a cupboard.
Whenever someone takes an item of lifting gear I have to use SFTP to open the .csv register that's held on the server, update it to include the gear that's just been issued, then I have to SSH into the server, cd to the script's location, then execute it.
But today I've worked out how to use sshfs to mount the database location on my local machine, have created a bash alias to execute the script on the server, and have connected the two computers with an SSH key. So updating the register is as easy as just opening the .csv in a local folder, then to execute the script to send the changes to the database I just type "lifting-gear" into a terminal window, and that's that.
All that working out has taken me several hours, but it'll save me a good minute or two every few weeks, so I consider that time well spent.
This xkcd came to mind. On one hand, I'm not sure about the time efficiency here. OTOH, figuring out this sort of workflow improvement is rewarding in itself beyond the basic time tradeoff.
The way I see it, it's knowledge I can use in other areas. There's at least a dozen more elements I need to add to the dashboard that I've cobbled together, and now most of it can be done effectively locally. I won't have to keep SSHing into the server, which will make the workflow that much quicker.
And it's opened my mind to looking for other ways to work smarter, which is invaluable in itself.
And it’s opened my mind to looking for other ways to work smarter, which is invaluable in itself.
100% agreed. The straight up time tradeoff doesn't account for the benefits of the learning experience.
"Why spend 5 minutes doing it when I can spend 5 days automating it?"
Exactly! 🤣
I clicked, expecting to see a different xkcd. Then I searched for the one I expected and (re-?)discovered Time (#1190) which took a fair while to go through (since I started when your comment was fairly new).
Ha, 1319 was the one that came up when I did a search for this!
Well done, and this is coming from someone working in IT and data centers for over 20 years. The practical non overkill solutions are my favorites.
Do you use Arch, btw?
No, like I said, I'm not a programmer. I couldn't possibly handle the power of Arch. I use Kubuntu, like a filthy casual.
I think the DMC distro of choice would be Debian. Been around since the ancient times and works well enough.
My Linux journey over the past 18 months has been Mint > KDE Neon > Kubuntu > Debian.
Well, Kubuntu for the machines I use, but Debian for a couple of servers I run. The one at work, but also my main server at home; an old Mac Mini. It may only have 8GB RAM, but I've got it running a bunch of different services and it's 99% stable. Got a bit wobbly when I imported all of my iCloud photo library into Immich, but I soon worked out to do it a bunch at a time. Importing 50 photos and watching HTOP as all four CPU cores suddenly spiked to 100% was quite the experience.
Automating to save time is a pipe dream. Automating ensures replicability, though, and that's the real value.
Nice!
If that recipe gives you any trouble, check out ssh -C.
What does that do?
It allows you to run a command on tht remote system, after establishing an SSH session.
Networked databases with clients have been a thing since PC's have had networking.
This seems like you're using the wrong tool for the job.
Lol, love the solution though, classic "doing more to make things easier" that we all get caught in.
Still, nice work!
Thing is, IT like this isn't anywhere near the main thrust of the (very) old school engineering firm I work for. The boss considers it enough that there's a shared SMB server, though if questioned on it he'd admit that he's got no idea how it works. Most of the computers are still running Windows 10. Mine is one of three that are running one form of Linux or another, the server is another. Almost all of the company's money is made by the folks on the shop floor, swinging hammers and spanners.
So I saw a need for something and did what I could with what I know to make a first draft of it, and it works quite well. As time goes on, and it shows its worth, maybe we'll employ someone who knows what they're doing, someone who can make it a robust, modern answer. But for now my little hodge podge will work, albeit fairly manually.
I'm not a programmer, and don't really know that much about these things
Clearly a lie.
I'm really not. Until a few years ago I was a welder with delusions of grandeur, who got promoted to quality manager.
I am a nerd though.
I believe you, but the number of people in my life who have any clue what ssh is is pretty much equal to the number of people I know who work in my industry.
As someone who's been bitten by the self hosting bug, that shit is a lifesaver.
Headless servers definitely help.