Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
peepsalot
Apr 24, 2007

        PEEP THIS...
           BITCH!

Severing posted:

I just use Notepad via Wine, it's simple and gets the job done.

:vince:

Adbot
ADBOT LOVES YOU

mystes
May 31, 2006

I just print the files out, edit them on paper, and type them back in. Works great!

BlankSystemDaemon
Mar 13, 2009



I used Foobar2000 because until I discovered mpd, it was the only music player that could handle my music collection.

pseudorandom name
May 6, 2007

Computer viking posted:

I envision some engineer working on WSL angrily muttering to himself while typing "notepad.cpp" into the appropriate search box, but your theory is also quite plausible.

The weird thing is that Notepad has been a very thin wrapper around the basic Windows edit control for most of its existence, so alternate line endings required a non-trivial amount of work.

Not Wolverine
Jul 1, 2007
I installed Kubuntu 19.10 this morning, and it's working great except my BIOS/UEFI options seem a bit odd. I noticed in my UEFI options I have:

code:
ubuntu
UEFI-OS
ubuntu
Samsung SSD
Originally, the first "ubuntu" was selected, and that would only take me to a non flashing cursor. The 2nd ubuntu boots just great, but why do I have so many options? I fixed this in the UEFI settings but I would really like to know if there is a way to find out what all of these options are, should I be using "UEFI-OS" instead?

Previously, I had Kubuntu 20.04 on this PC beta testing and upgrading about a hundred packages a day with no problems, but today I finally got bit and the upgrade hosed the install. I made a few attempts to use the recovery console to clean up the packages but it wasn't going anywhere and this PC is a spare test computer so I felt it was just easier to install a more stable 19.10 instead and upgrade to 20.04 in another month when things settle down. With 20.04 I had no unusual boot issues, except for the fact I couldn't create a working 20.04 bootable USB no matter what I tried and I had to burn a DVD. When I installed 19.10 I told it to use erase the whole disk but I'm paranoid the previous install might be causing my problems somehow.

Severing
Aug 26, 2017

The other ubuntu entry will be from your previous install more than likely.

Butterwagon
Mar 21, 2010

Lookit that stupid ass-hole!
I've managed to screw up my zsh. I'm no longer able to see any stderr output.

I've tried resetting my .zshrc to defaults and also uninstalling and reinstalling zsh.

I am able to see stderr output in bash, just not zsh. I've tried different terminal emulators as well.

I'm not very proficient with linux so can somebody tell me what I might have screwed up?

Fantastic Foreskin
Jan 6, 2013

A golden helix streaked skyward from the Helvault. A thunderous explosion shattered the silver monolith and Avacyn emerged, free from her prison at last.

Let's play the 'what distro should I use' game. With my main PC hooked up to a tv, I decided to revive an old one I had sitting around for things like checking emails and paying bills. Since I didn't want to spend a bunch of money on mere convenience here it's only got 4gb of ram and a 32gb SSD I had lying around in it. I've already got an UbuntuMate liveusb so 99% I'll go with that but I'm open to suggestions. All it needs to do is run a web browser and keepassX.

Severing
Aug 26, 2017

ItBreathes posted:

Let's play the 'what distro should I use' game. With my main PC hooked up to a tv, I decided to revive an old one I had sitting around for things like checking emails and paying bills. Since I didn't want to spend a bunch of money on mere convenience here it's only got 4gb of ram and a 32gb SSD I had lying around in it. I've already got an UbuntuMate liveusb so 99% I'll go with that but I'm open to suggestions. All it needs to do is run a web browser and keepassX.

It basically doesn't matter, so I'll say Lubuntu as its more light weight than Mate. Only real difference is the wm.

Fantastic Foreskin
Jan 6, 2013

A golden helix streaked skyward from the Helvault. A thunderous explosion shattered the silver monolith and Avacyn emerged, free from her prison at last.

Yeah I was just wondering if anyone had any 'interesting' suggestions. I went with Lubuntu over Mate to save ~100Mb of memory usage, but turns out the most limiting factor is the old-rear end AMD dual core that gets up to 80% usage when loading a web page :eng99: It works fine for this purpose though.

Saukkis
May 16, 2003

Unless I'm on the inside curve pointing straight at oncoming traffic the high beams stay on and I laugh at your puny protest flashes.
I am Most Important Man. Most Important Man in the World.

ItBreathes posted:

Yeah I was just wondering if anyone had any 'interesting' suggestions. I went with Lubuntu over Mate to save ~100Mb of memory usage, but turns out the most limiting factor is the old-rear end AMD dual core that gets up to 80% usage when loading a web page :eng99: It works fine for this purpose though.

What kind of ad and javascript blocking are you using?

Fantastic Foreskin
Jan 6, 2013

A golden helix streaked skyward from the Helvault. A thunderous explosion shattered the silver monolith and Avacyn emerged, free from her prison at last.

uBlock origin and noscript. Considered dropping noscript since I won't be don't any general browsing on this machine but for the same reason the extra overhead isn't meaningful.

That said, I did just learn my password manager stopped being developed years ago. What's the go-to choice for a Linux password manager these days, and can it import kdbx files?

Volguus
Mar 3, 2009

ItBreathes posted:

uBlock origin and noscript. Considered dropping noscript since I won't be don't any general browsing on this machine but for the same reason the extra overhead isn't meaningful.

That said, I did just learn my password manager stopped being developed years ago. What's the go-to choice for a Linux password manager these days, and can it import kdbx files?

I use KeePassXC which seems to be still maintained.

Storm One
Jan 12, 2011
+1 for KeePassXC, and as you've noticed JS-heavy browsing on an old dual-core is going to suck no matter. I'm running Xfce and average RAM usage is under 3 GB, with over 1/3 of that going to Firefox alone.

CaptainSarcastic
Jul 6, 2013



You could try running Firefox and reducing the number of processes it is allowed to run. On a low-RAM machine I've seen some improvement lowering it to 4, but your mileage might vary.

I also turn off autoplay anything, run uBlock Origin and a blocker equivalent to NoScript.

Fantastic Foreskin
Jan 6, 2013

A golden helix streaked skyward from the Helvault. A thunderous explosion shattered the silver monolith and Avacyn emerged, free from her prison at last.

Like I said, it's not really an issue, this machine only exists to pay bills with, it only has to load 6 or so webpages once a month. It's more amusing that this CPU, which was the heart of my main computer like 5 years ago, is barely up to the task of browsing the web anymore.

CaptainSarcastic
Jul 6, 2013



That's fine - I just can't help projecting my compulsive irritation with slow page loads and attempts to improve performance on low-end systems. I'm currently so irritated with the desktop I have to use at work that I have half-heartedly considered taking in a spare SSD and cloning the HDD onto it in order to get something closer to acceptable performance. Good god I had forgotten how painful an HDD could be.

*click to open a new tab
*HDD thrashes
*wait
*tab opens

:bahgawd:

BlankSystemDaemon
Mar 13, 2009



ItBreathes posted:

uBlock origin and noscript. Considered dropping noscript since I won't be don't any general browsing on this machine but for the same reason the extra overhead isn't meaningful.

That said, I did just learn my password manager stopped being developed years ago. What's the go-to choice for a Linux password manager these days, and can it import kdbx files?
If you enable advanced user functionality in ublock origin, you can enable dynamic filtering which lets you have noscript-like functionality, and if you then set the "Relax blocking mode" to ctrl+alt+b, you can turn it off for individual pages with one or maybe two presses of that key combination.

EDIT: The basic ruleset I'm using might even be better than the default-deny ruleset above:
pre:
* * 3p block
* * 3p-frame block
* * 3p-script block
behind-the-scene * 1p-script noop
behind-the-scene * 3p noop
behind-the-scene * 3p-frame noop
behind-the-scene * 3p-script noop
behind-the-scene * image noop
behind-the-scene * inline-script noop
no-large-media: behind-the-scene false
no-scripting: behind-the-scene false

BlankSystemDaemon fucked around with this message at 00:10 on Mar 16, 2020

RFC2324
Jun 7, 2012

http 418

CaptainSarcastic posted:

That's fine - I just can't help projecting my compulsive irritation with slow page loads and attempts to improve performance on low-end systems. I'm currently so irritated with the desktop I have to use at work that I have half-heartedly considered taking in a spare SSD and cloning the HDD onto it in order to get something closer to acceptable performance. Good god I had forgotten how painful an HDD could be.

*click to open a new tab
*HDD thrashes
*wait
*tab opens

:bahgawd:

I get annoyed at the occasional load time from my m.2, going back to an HDD might literally cause me to stroke

BlankSystemDaemon
Mar 13, 2009



I too wish for a world with non-volatile main storage at DRAM speeds with as many write-cycles as DRAM has.

spiritual bypass
Feb 19, 2008

Grimey Drawer
Keeping my homedir in a RAID 1 with the main OS on a SSD has made my system feel pretty quick without sacrificing reliability for the data I actually care about

ToxicFrog
Apr 26, 2008


Diggus Bickus posted:

I've managed to screw up my zsh. I'm no longer able to see any stderr output.

I've tried resetting my .zshrc to defaults and also uninstalling and reinstalling zsh.

I am able to see stderr output in bash, just not zsh. I've tried different terminal emulators as well.

I'm not very proficient with linux so can somebody tell me what I might have screwed up?

That's weird as hell. You mentioned resetting .zshrc -- did you check .zshenv and .zlogin as well? What if you invoke it with zsh --norcs --noglobalrcs? type -a zsh to make sure you don't have some weird aliasing issue going on?

Also what happens if you redirect stderr of a program to stdout with program 2>&1 -- does it show up then? What about program 2>/dev/stderr or program 2>/dev/tty?

telcoM
Mar 21, 2009
Fallen Rib

Crotch Fruit posted:

I installed Kubuntu 19.10 this morning, and it's working great except my BIOS/UEFI options seem a bit odd. I noticed in my UEFI options I have:

code:
ubuntu
UEFI-OS
ubuntu
Samsung SSD


Use
code:

sudo efibootmgr -v
to ger more information on the boot options.

Once you know the four-digit number (BootNNNN) of the failing boot option, you can use the "efibootmgr" command with other options to delete it. See "man efibootmgr" for details and examples.

Severing
Aug 26, 2017

telcoM posted:

Use
code:
sudo efibootmgr -v
to ger more information on the boot options.

Once you know the four-digit number (BootNNNN) of the failing boot option, you can use the "efibootmgr" command with other options to delete it. See "man efibootmgr" for details and examples.

Alternatively, some BIOSes (like mine) allow you to delete them too.

Not Wolverine
Jul 1, 2007

telcoM posted:

Use
code:
sudo efibootmgr -v
to ger more information on the boot options.

Once you know the four-digit number (BootNNNN) of the failing boot option, you can use the "efibootmgr" command with other options to delete it. See "man efibootmgr" for details and examples.

Thanks, I deleted the first ubuntu option since it was marked inactive and the system is still booting fine now.

Butterwagon
Mar 21, 2010

Lookit that stupid ass-hole!

ToxicFrog posted:

That's weird as hell. You mentioned resetting .zshrc -- did you check .zshenv and .zlogin as well? What if you invoke it with zsh --norcs --noglobalrcs? type -a zsh to make sure you don't have some weird aliasing issue going on?

Also what happens if you redirect stderr of a program to stdout with program 2>&1 -- does it show up then? What about program 2>/dev/stderr or program 2>/dev/tty?

Looks like it's some kind of antigen problem. Removing all antigen packages seems to fix it -- just need to figure out which package is causing the problem.

Antigen seems to setup its own config file that gets sourced whether or not it's sourced by your zshrc.

Mr. Crow
May 22, 2008

Snap City mayor for life
Anyone familiar with LVM snapshots?

I'm trying to create a snapshot of my root partition before I do a dist upgrade on Fedora 29 and there is some issue with my boot settings that is preventing me from booting once I create the snapshot. Basically the system sees the root LVM just fine, decrypts it and loads it up but then it fails to fully load it because it can't find the snapshot volume and so it pukes and drops to emergency shell (eventually).

I think I just need to update grub.cfg or something to tell it about the snapshot volume but I'm at a loss as to what specifically I need to do.


I'll post lsblk and some other files when I recover the machine again.

taqueso
Mar 8, 2004


:911:
:wookie: :thermidor: :wookie:
:dehumanize:

:pirate::hf::tinfoil:

From the description I'm not sure what it would be. I use lvm snapshots all the time so hopefully I can help a bit once you post more info. What does the grub kernel config line look like?

F4rt5
May 20, 2006

RFC2324 posted:

I get annoyed at the occasional load time from my m.2, going back to an HDD might literally cause me to stroke
I got a cheap HP 6305 SFF with an A8 5500B quad-core to use as a media center thing. CPU actually snappy enough for general use, deluged, emulation etc, 8 GB of RAM is enough, but the 1 TB WD Green from 2012 made everything a nightmare (and to add pain I formatted it as BTRFS lol). Not having used spinning rust for boot drives since 2013, I was surprised how bad it was.

As soon as I could I bought a new SSD and threw the older Intel 530 240 GB in the HP as a boot drive.

Sweet, sweet relief!

I wonder how long it will last, though. That Intel just crossed 82 TBW, and that's its MTBF...

gourdcaptain
Nov 16, 2012

One thing I'm wondering as someone who just set up for their home file server their first mdadm RAID array - if a drive fails/starts erroring hard, how do you figure out which physical drive to replace other than trial and error, given Linux drive letters (/dev/sdX) correspond to basically nothing beyond the order they were detected in at boot?

(Also found out the main way that those tools are set to alert you of RAID issues is via email servers which was uh... interesting to rig up solely for this purpose.)

gourdcaptain fucked around with this message at 20:11 on Mar 18, 2020

Mr. Crow
May 22, 2008

Snap City mayor for life
Here is some information.

root == /dev/sde2 == UUID="8316b495-1124-4c35-a434-e5598ab6cb1a" == /dev/fedora-vg/root
snapshot == /dev/sde5 == UUID="2f300a37-29e1-478b-a0b0-640f2c809ab5" == /dev/fedora-vg/root-snapshot

I did notice that in the journal for the emergency shell it was trying to load a UUID of something I don't recognize.. IH3... something or other. Unfortunately I can't save the rdsosemergency.txt as I can't mount a usb... unknown file type iso9660 :nice:

I'll probably take a screenshot with my phone I guess if I can't find it.

$ blkid
code:
/dev/sde1: LABEL="boot" UUID="a9b70dad-a901-4448-8b3b-344fd4a9a89c" TYPE="ext4" PARTUUID="131b78cf-01"
/dev/sde2: UUID="8316b495-1124-4c35-a434-e5598ab6cb1a" TYPE="crypto_LUKS" PARTUUID="131b78cf-02"
/dev/sde3: UUID="55860764-9251-45ef-b639-e1719dfe7a21" TYPE="crypto_LUKS" PARTUUID="131b78cf-03"
/dev/sde5: UUID="2f300a37-29e1-478b-a0b0-640f2c809ab5" TYPE="crypto_LUKS" PARTUUID="131b78cf-05"
$ lsblk

quote:

sde 8:64 1 489.1G 0 disk
├─sde1 8:65 1 1G 0 part /run/media/liveuser/boot
├─sde2 8:66 1 55.8G 0 part
│ └─luks-8316b495-1124-4c35-a434-e5598ab6cb1a 253:2 0 55.8G 0 crypt
│ ├─fedora--vg-root-real 253:4 0 40G 0 lvm
│ │ ├─fedora--vg-root 253:5 0 40G 0 lvm
│ │ └─fedora--vg-root--snapshot 253:7 0 40G 0 lvm
│ ├─fedora--vg-root--snapshot-cow 253:6 0 10G 0 lvm
│ │ └─fedora--vg-root--snapshot 253:7 0 40G 0 lvm
│ └─fedora--vg-swap 253:8 0 15.8G 0 lvm
├─sde3 8:67 1 300G 0 part
├─sde4 8:68 1 1K 0 part
└─sde5 8:69 1 10G 0 part
└─luks-2f300a37-29e1-478b-a0b0-640f2c809ab5 253:3 0 10G 0 crypt
└─fedora--vg-root--snapshot-cow 253:6 0 10G 0 lvm
└─fedora--vg-root--snapshot 253:7 0 40G 0 lvm

Unfortunately I can't get much information in a chroot as LVM is apparently broken according to https://bbs.archlinux.org/viewtopic.php?id=242594; the proposed fix doesn't work.

$ /etc/default/grub
code:
GRUB_CMDLINE_LINUX="resume=/dev/mapper/fedora--vg-swap rd.lvm.lv=fedora-vg/root rd.luks.uuid=luks-8316b495-1124-4c35-a434-e5598ab6cb1a rd.lvm.lv=fedora-vg/swap rhgb quiet"
$ /boot/grub2/grub.cfg
code:
menuentry 'Fedora (5.3.11-100.fc29.x86_64) 29 (Server Edition)' --class fedora --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-5.3.11-100.fc29.x86_64-advanced-424e2995-9a6d-49a7-81cb-8a6688c68ac2' {
	load_video
	set gfxpayload=keep
	insmod gzio
	insmod part_msdos
	insmod ext2
	set root='hd4,msdos1'
	if [ x$feature_platform_search_hint = xy ]; then
	  search --no-floppy --fs-uuid --set=root --hint-bios=hd4,msdos1 --hint-efi=hd4,msdos1 --hint-baremetal=ahci4,msdos1  a9b70dad-a901-4448-8b3b-344fd4a9a89c
	else
	  search --no-floppy --fs-uuid --set=root a9b70dad-a901-4448-8b3b-344fd4a9a89c
	fi
	linux	/vmlinuz-5.3.11-100.fc29.x86_64 root=/dev/mapper/fedora--vg-root ro resume=/dev/mapper/fedora--vg-swap rd.lvm.lv=fedora-vg/root rd.luks.uuid=luks-8316b495-1124-4c35-a434-e5598ab6cb1a rd.lvm.lv=fedora-vg/swap rhgb quiet  intel_iommu=on iommu=pt  rd.driver.pre=vfio-pci  elevator=deadline 
	initrd	/initramfs-5.3.11-100.fc29.x86_64.img
}
$ /etc/crypttab
code:
luks-8316b495-1124-4c35-a434-e5598ab6cb1a UUID=8316b495-1124-4c35-a434-e5598ab6cb1a none discard
luks-55860764-9251-45ef-b639-e1719dfe7a21 UUID=55860764-9251-45ef-b639-e1719dfe7a21 none discard
luks-2f300a37-29e1-478b-a0b0-640f2c809ab5 UUID=2f300a37-29e1-478b-a0b0-640f2c809ab5 /etc/luks-keys/luks-2f300a37-29e1-478b-a0b0-640f2c809ab5
$ /etc/fstab
code:
/dev/mapper/fedora--vg-root			/                       xfs     defaults,x-systemd.device-timeout=0 0 0
UUID=a9b70dad-a901-4448-8b3b-344fd4a9a89c	/boot                   ext4    defaults			    1 2
/dev/mapper/fedora--vg-swap			swap                    swap    defaults,x-systemd.device-timeout=0 0 0
Anything else?

EDIT: got it resolved.

I had to remove the /etc/luks-keys/luks-2f300a37-29e1-478b-a0b0-640f2c809ab5 from crypttab and tell the kernel via GRUB_CMDLINE_LINUX to load the snapshot before the root lv.

code:
rd.lvm.lv=fedora-vg/root-snap rd.luks.uuid=luks-2f300a37-29e1-478b-a0b0-640f2c809ab5
Regenerate grub and works fine now.

Mr. Crow fucked around with this message at 01:09 on Mar 19, 2020

BlankSystemDaemon
Mar 13, 2009



Anyone want a blast from the past? Multi-seat seating on a single workstation ala IRIX - which had it in 1996, a full decade before Xorg 6.9 added it -and it's quite fascinating to remember that time.
Back then 6 browsers and video games couldn't bring one $520 computer with a 2GHz single-core processor to its knees with, whereas you'd need several thousand freedom bucks to buy yourself the kind of Threadripper or EPYC processor that could handle all the threads, plus an actual shitload of memory and 6 graphics cards with custom watercooling loop.

Sometimes I wonder where we went wrong.
Then I realize that maybe this is what we deserve, and that makes me sad.

Fantastic Foreskin
Jan 6, 2013

A golden helix streaked skyward from the Helvault. A thunderous explosion shattered the silver monolith and Avacyn emerged, free from her prison at last.

F4rt5 posted:

I got a cheap HP 6305 SFF with an A8 5500B quad-core to use as a media center thing. CPU actually snappy enough for general use, deluged, emulation etc, 8 GB of RAM is enough, but the 1 TB WD Green from 2012 made everything a nightmare (and to add pain I formatted it as BTRFS lol). Not having used spinning rust for boot drives since 2013, I was surprised how bad it was.

As soon as I could I bought a new SSD and threw the older Intel 530 240 GB in the HP as a boot drive.

Sweet, sweet relief!

I wonder how long it will last, though. That Intel just crossed 82 TBW, and that's its MTBF...

What happened in that poor drives life?

taqueso
Mar 8, 2004


:911:
:wookie: :thermidor: :wookie:
:dehumanize:

:pirate::hf::tinfoil:

gourdcaptain posted:

One thing I'm wondering as someone who just set up for their home file server their first mdadm RAID array - if a drive fails/starts erroring hard, how do you figure out which physical drive to replace other than trial and error, given Linux drive letters (/dev/sdX) correspond to basically nothing beyond the order they were detected in at boot?

(Also found out the main way that those tools are set to alert you of RAID issues is via email servers which was uh... interesting to rig up solely for this purpose.)

You can use the UUID of the arrays / disks to refer to them exactly. cat /proc/mdstat will tell you info about what is broken should you need to know.

taqueso
Mar 8, 2004


:911:
:wookie: :thermidor: :wookie:
:dehumanize:

:pirate::hf::tinfoil:

Mr. Crow posted:

Here is some information.


Anything else?

It looks pretty reasonable at a glance, I'll try to give it another look when I'm not at work

F4rt5
May 20, 2006

ItBreathes posted:

What happened in that poor drives life?
A crapload of torrent downloads, photo and video work for three years, I guess.

E: My two 2TB WD AV-GP drives from 2013 has between 67K and 70K hours power-on time and are still going strong (knock on wood). Made me discover an overflow error in Gsmartctl (it displayed 2-3K hours power-on time lol).

Everything's safe on backup drives and in Backblaze B2 until I can afford new rust though, just in case.

F4rt5 fucked around with this message at 21:21 on Mar 18, 2020

Saukkis
May 16, 2003

Unless I'm on the inside curve pointing straight at oncoming traffic the high beams stay on and I laugh at your puny protest flashes.
I am Most Important Man. Most Important Man in the World.

gourdcaptain posted:

One thing I'm wondering as someone who just set up for their home file server their first mdadm RAID array - if a drive fails/starts erroring hard, how do you figure out which physical drive to replace other than trial and error, given Linux drive letters (/dev/sdX) correspond to basically nothing beyond the order they were detected in at boot?

(Also found out the main way that those tools are set to alert you of RAID issues is via email servers which was uh... interesting to rig up solely for this purpose.)

Logs should be able to tell which /dev/sdX is having problems, after that 'hdparm -i' or 'smartctl -a' can tell the model and serial number of that drive. I've printed the serial numbers on a sticker with larger font and stuck them on both ends of the drives to identify them more easily.

gourdcaptain
Nov 16, 2012

Saukkis posted:

Logs should be able to tell which /dev/sdX is having problems, after that 'hdparm -i' or 'smartctl -a' can tell the model and serial number of that drive. I've printed the serial numbers on a sticker with larger font and stuck them on both ends of the drives to identify them more easily.

Ah, cool. Yeah, the serial number thing makes sense, assuming they don't fall off the bus entirely, and then I can check which ones show up in the BIOS by SATA port.

Also as someone who made a wrong bet before when setting up their previous RAID array and using btrfs (it was uh... less doomed looking at the time), the ext4 on mdadm RAID10 far 2 I've got running right now is so much more responsive than the btrfs RAID10 in my previous setup (it was also built on cheap surplus OEM Hitachi drives on a budget, which didn't help). Missing reflinking and the theoretical promise of self-healing arrays, but that's about it. (mdadm construction commands are uh... let's go with complex, though.) Not using zfs even though it's probably what I want because I'm kinda nervous about having a major system on an out-of-tree kernel module filesystem.

fletcher
Jun 27, 2003

ken park is my favorite movie

Cybernetic Crumb
Trying to write a little bash script that will ssh to a remote server, switch to the postgres user, and then run psql with some command.

I got as far as:
code:
ssh -t my-db-server "sudo su postgres -c 'cd /var/lib/pgsql; psql'"
That works and gets me to the psql command prompt at least

So now I need to change it to feed the command I want to run with psql -c

The command I want to run is:
code:
\copy (SELECT schema_name FROM information_schema.schemata WHERE schema_name LIKE '\_%' ORDER BY schema_name) TO '/tmp/whatever.csv' WITH CSV HEADER
I'm getting lost in a mess of trying to escape quotes though, can't help but think there's another way to go about this?

Adbot
ADBOT LOVES YOU

minato
Jun 7, 2004

cutty cain't hang, say 7-up.
Taco Defender
Maybe
code:
ssh -t my-db-server "sudo su postgres -c 'cd /var/lib/pgsql; psql'" <<EOF
\copy (SELECT schema_name FROM information_schema.schemata WHERE schema_name LIKE '\_%' ORDER BY schema_name) TO '/tmp/whatever.csv' WITH CSV HEADER
EOF

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply