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
a slime
Apr 11, 2005

Misogynist posted:

If you're saying you want to use a specific interface/IP address to make connections to your remote server, you're describing routing. You'll want to update your routing table so traffic to a particular endpoint always uses the egress interface you've chosen.

Yeah, this is what I ended up doing. Thanks!

code:
ip route add restrictedserver src XXX.XXX.XXX.XXX dev eth0

Adbot
ADBOT LOVES YOU

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!
Is there a view that Ubuntu 14.04 isn't quite up for prime-time yet? I have been using an Ubuntu version that is pretty old at this point. I had to check some code that would be easier to check in Linux, and I figured I might as well fire up a new VM with Ubuntu 14.04. In normal interaction, it seemed fine, but I wanted a full 1920x1200 resolution (Hyper-V woes here), so I started setting up RDP. Everything slid downhill fast. Gnome was incompatible with xrdp, so I had to use XFCE with it. There were OpenGL issues with that, so qtcreator would blow up when starting up; I guess it would try to do some OpenGL stuff. I found something online to disable the OpenGL parts of qtcreator, and then it wouldn't find my keyboard mapping, so I couldn't type anything.

I went back to my old Ubuntu VM, got qtcreator up on there, and everything was fine.

revmoo
May 25, 2006

#basta
Stupid question--on Debian I have to manually run ifup eth0 for my WAN interface, what's the proper way to run this command on boot? This is my network router and it used to work so I think I broke it somewhere.

JHVH-1
Jun 28, 2002
Add "auto eth0" to your interfaces file https://wiki.debian.org/NetworkConfiguration

revmoo
May 25, 2006

#basta
Yeah that's it thank you.

Snak
Oct 10, 2005

I myself will carry you to the Gates of Valhalla...
You will ride eternal,
shiny and chrome.
Grimey Drawer
I tried googling this but couldn't find it...

Is there an easy way to open another terminal and have it start in the directory I am in in my current terminal?

edit: In Ubuntu 12.04

taqueso
Mar 8, 2004


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

:pirate::hf::tinfoil:

Snak posted:

I tried googling this but couldn't find it...

Is there an easy way to open another terminal and have it start in the directory I am in in my current terminal?

edit: In Ubuntu 12.04

When I hit ctrl-shift-T or ctrl-shift-N, it does exactly that.

Snak
Oct 10, 2005

I myself will carry you to the Gates of Valhalla...
You will ride eternal,
shiny and chrome.
Grimey Drawer

taqueso posted:

When I hit ctrl-shift-T or ctrl-shift-N, it does exactly that.

Thanks, I did not know about that shortcut, and had been using CTRL-ALT-T, which opens a new terminal in the home directory.

taqueso
Mar 8, 2004


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

:pirate::hf::tinfoil:

Snak posted:

Thanks, I did not know about that shortcut, and had been using CTRL-ALT-T, which opens a new terminal in the home directory.

And I didn't know about that one. Seems like ctrl-alt-T is a global shortcut, ctrl-shift-t is a shortcut from within the terminal app.

fletcher
Jun 27, 2003

ken park is my favorite movie

Cybernetic Crumb

Snak posted:

I tried googling this but couldn't find it...

Is there an easy way to open another terminal and have it start in the directory I am in in my current terminal?

edit: In Ubuntu 12.04

You already got an answer but you may also want to check out Terminator. One of the features I like is that you can right click on the terminal and go to Split and then the new split terminal is in the same directory.

edit: whoops nevermind, that was from my bashrc :( Terminator is still awesome though!

fletcher fucked around with this message at 21:54 on Jul 10, 2014

BoyBlunder
Sep 17, 2008
I have a file (A) and I want to feed it into a script, to do some file manipulation:

code:
while read LINE ; do
    cp $1 B-$1
    #remove line breaks
    sed -i ':a;N;$!ba;s/\n/ /g' B-$1
    #add commas
    echo "foo `sed -e "s/ /, /g" B-$1`" > B-vm-$1
done < $1
I run it with this
code:
./script A
, but all it does is make a file with the first line of A. How do I make it so it only reads the file name, and continues through the loop?

evol262
Nov 30, 2010
#!/usr/bin/perl

BoyBlunder posted:

I have a file (A) and I want to feed it into a script, to do some file manipulation:

code:
while read LINE ; do
    cp $1 B-$1
    #remove line breaks
    sed -i ':a;N;$!ba;s/\n/ /g' B-$1
    #add commas
    echo "foo `sed -e "s/ /, /g" B-$1`" > B-vm-$1
done < $1
I run it with this
code:
./script A
, but all it does is make a file with the first line of A. How do I make it so it only reads the file name, and continues through the loop?
Let's take a step back:

Why are you even looping? Is there something you want to do with the contents of A? What's the purpose? Example input and intended output?

BoyBlunder
Sep 17, 2008

evol262 posted:

Let's take a step back:

Why are you even looping? Is there something you want to do with the contents of A? What's the purpose? Example input and intended output?

I'm looping because I want the contents of A to become 2 different files:

(filename B-${filename_fed_into_script}) 1 2 3 4 5 6
(filename B-vm-${filename_fed_into_script}) foo 1, 2, 3, 4, 5, 6

from this:

1
2
3
4
5
6

edit: clarity

BoyBlunder fucked around with this message at 23:31 on Jul 10, 2014

Roundboy
Oct 21, 2008
posting this here as its probably a general thing vs ubuntu, but:

in the last couple of days, my OS SSD drive, which i have set to remount RO on error, has been doing so. A reboot fixes it, but I'm not seeing anything obvious in logs.

I know this is pretty general, but has anyone come across this ?

evol262
Nov 30, 2010
#!/usr/bin/perl

BoyBlunder posted:

I'm looping because I want the contents of A to become 2 different files:

(filename B-${filename_fed_into_script}) 1 2 3 4 5 6
(filename B-vm-${filename_fed_into_script}) foo 1, 2, 3, 4, 5, 6

from this:

1
2
3
4
5
6

edit: clarity

There's no reason to loop and do this once per line in the file unless you're manipulating $LINE (you aren't).

What's the actual output you're getting?

evol262
Nov 30, 2010
#!/usr/bin/perl

Roundboy posted:

posting this here as its probably a general thing vs ubuntu, but:

in the last couple of days, my OS SSD drive, which i have set to remount RO on error, has been doing so. A reboot fixes it, but I'm not seeing anything obvious in logs.

I know this is pretty general, but has anyone come across this ?

Check dmesg before you reboot. The filesystem is ro. It can't write the logs.

pipebomb
May 12, 2001

Dear God, what is it like in your funny little brains?
It must be so boring.
Do you guys have any opinions on the best way to do this?

I registered a domain that I want to offer up as a vanity email domain. Simple features really:

Free = forwards your vanity email to an address of your choosing.
Paid = full pop/imap/webmail.

What do you think would be the best package/s to handle something like this?

spankmeister
Jun 15, 2008






Postfix or exim with dovecot and squirrelmail and/or roundcube

BoyBlunder
Sep 17, 2008

evol262 posted:

There's no reason to loop and do this once per line in the file unless you're manipulating $LINE (you aren't).

What's the actual output you're getting?

$ ./script A
./script: line 18: syntax error near unexpected token `done'
./script: line 18: `done < $1'

It also does make the B-* files, so that's pretty good, I just don't understand why it spits out an error.

Here's the script again (I got rid of the loop):

code:

#!/bin/sh

    cp $1 B-$1 ;
    sed -i ':a;N;$!ba;s/\n/ /g' B-$1 ;
    echo "foo `sed -e "s/ /, /g" B-$1`" > B-vm-$1;

done < $1

exit 0

BoyBlunder fucked around with this message at 11:07 on Jul 11, 2014

Roundboy
Oct 21, 2008

evol262 posted:

Check dmesg before you reboot. The filesystem is ro. It can't write the logs.

hmm, just happened again, and dmesg has not been updated at all. This is a problem in the last 3 days or so, and nothing has changed system-wise ..

I'll move this to a proper thread vs general one of questions now

telcoM
Mar 21, 2009
Fallen Rib

BoyBlunder posted:

It also does make the B-* files, so that's pretty good, I just don't understand why it spits out an error.

code:

#!/bin/sh

    cp $1 B-$1 ;
    sed -i ':a;N;$!ba;s/\n/ /g' B-$1 ;
    echo "foo `sed -e "s/ /, /g" B-$1`" > B-vm-$1;

done < $1

exit 0

You have removed only 2 parts of the 3-part "while ... do ... done" loop compound. The shell is thinking: "I have seen neither 'select', 'for' nor 'while' with a 'do' anywhere around, so what on earth is this 'done' doing here all by itself???"

But at that point the previous commands have apparently done everything you need, so the error does not prevent your script from doing its job. Just remove the "done < $1" line to get rid of the message; that line does not make sense now that the loop is gone.

Also, you don't need semicolons at the end of each line in sh scripts (but they don't hurt either).

the
Jul 18, 2004

by Cowcaster
I'm reading these instructions on how to schedule a scan with clamscan, and I don't get it:

quote:

You can use the at command to schedule clamscan or freshclam. For example:

code:
at 3:30 tomorrow
at>clamscan -i /home/user | mail [email]user@example.com[/email]
at> <CTRL-D> 
job 3 at 2005-04-28 03:30
You have now scheduled a ClamAV scan to happen on your home directory at 3:30 AM tomorrow. The output (showing only infected files) will be sent to you by e-mail.

edit: NM I figured it out!

Edit: Actually, how would I schedule this for every week instead of just tomorrow?

the fucked around with this message at 16:24 on Jul 11, 2014

Cidrick
Jun 10, 2001

Praise the siamese

the posted:

Edit: Actually, how would I schedule this for every week instead of just tomorrow?

Throw your clamscan command into your crontab. Something like this would have it scan every day at 2AM

code:
0 2 * * * clamscan -i /home/user | mail user@example.com

Thermopyle
Jul 1, 2003

...the stupid are cocksure while the intelligent are full of doubt. —Bertrand Russell

I want to disable/enable access to some samba shares to some specific hosts on a schedule.

What's the best way to do that?

evol262
Nov 30, 2010
#!/usr/bin/perl

Thermopyle posted:

I want to disable/enable access to some samba shares to some specific hosts on a schedule.

What's the best way to do that?

cron

deimos
Nov 30, 2006

Forget it man this bat is whack, it's got poobrain!

Thermopyle posted:

I want to disable/enable access to some samba shares to some specific hosts on a schedule.

What's the best way to do that?

You could create different smb.confs and link the correct one for the time of day using a cron script. Alternatively write a script that generates the correct smb.conf for the time of day and cron that.

The former is simpler for something like an easy home server kind of thing, the latter allows for much more control.



I completely forgot about sharesec, so cron that.

deimos fucked around with this message at 20:31 on Jul 11, 2014

Thermopyle
Jul 1, 2003

...the stupid are cocksure while the intelligent are full of doubt. —Bertrand Russell

Ahh yes, sharesec looks like something that'll work...

a dmc delorean
Jul 2, 2006

Live the dream
Can anyone help me with tint2?

Installed Arch Linux on my little laptop and I always move the task bar to the left side of the screen to save vertical space for other stuff.

Anyway, from top to bottom I have the clock, battery then tasks. I want the tasks to be the uppermost items, then the battery and clock to be at the bottom.

I managed to do this in Crunchbang a few months ago, but for the life of me cannot seem to get it right now. I'm editing tint2rc for these changes, just for clarification.

Also, one other question: how can I install the flash plug in for chromium? Tried chromium-pepper-flash from the repositories but pacman can't find it?

a dmc delorean fucked around with this message at 23:15 on Jul 11, 2014

Sauer
Sep 13, 2005

Socialize Everything!
Can't help you with Tint but for flash you install "chromium-pepper-flash" from the Arch User Repository (AUR). Either download the PKGBUILD file yourself and build it with "makepkg" or use a helper application like Yaourt or Packer, both also available from the AUR. You can also just install plain old regular Chrome if you like which has flash and PDF support and such built in if you don't mind your browser not being "free as in free speech". Its "google-chrome-stable" on the AUR. There's also the dev and beta versions, "google-chrome-dev, google-chrome-beta".

Edit:

Looking at Tint2's documentation there's a field called "panel_items" that determines the order in which entries on the bar are shown. I imagine if you flip the order of the items in the list it will do what you want.

Tint2 Documentation posted:

panel_items = LTSBC define the items tint2 will show and the order of those items. panel_items = STC will show the Systray, the taskbar and the clock (from left to right). SVN ONLY.
L to show Launcher
T to show Taskbar
S to show Systray (also called notification area)
B to show Battery status
C to show Clock

Sauer fucked around with this message at 03:13 on Jul 12, 2014

a dmc delorean
Jul 2, 2006

Live the dream

Sauer posted:

Can't help you with Tint but for flash you install "chromium-pepper-flash" from the Arch User Repository (AUR). Either download the PKGBUILD file yourself and build it with "makepkg" or use a helper application like Yaourt or Packer, both also available from the AUR. You can also just install plain old regular Chrome if you like which has flash and PDF support and such built in if you don't mind your browser not being "free as in free speech". Its "google-chrome-stable" on the AUR. There's also the dev and beta versions, "google-chrome-dev, google-chrome-beta".

Edit:

Looking at Tint2's documentation there's a field called "panel_items" that determines the order in which entries on the bar are shown. I imagine if you flip the order of the items in the list it will do what you want.

Thanks for the flash info! Going to give that a go soon.

I've tried using panel_items in the configuration file, but it doesn't seem to make a blind bit of difference. Sorry, should have mentioned that before.

reading
Jul 27, 2013
Has anyone had luck creating a ram disk and using it for Steam games in linux? I had trouble getting steam to recognize that I already had a certain game's files on my ramdisk. There aren't any available utilities either, everything that shows up in a web search is only for windows.

Then I also unmounted the ramdisk without realizing I needed to create an image, so, lost all the local files...

evol262
Nov 30, 2010
#!/usr/bin/perl

reading posted:

Has anyone had luck creating a ram disk and using it for Steam games in linux? I had trouble getting steam to recognize that I already had a certain game's files on my ramdisk. There aren't any available utilities either, everything that shows up in a web search is only for windows.

Then I also unmounted the ramdisk without realizing I needed to create an image, so, lost all the local files...

What do you mean by utilities? You can just mount -t tmpfs somewhere.

It'll probably need to be wherever the working directory is (~/path/to/steam/games). What did you try and what didn't work about it?

Polygynous
Dec 13, 2006
welp
^ I assume he's talking about utilities for managing steam games / backups which would most likely be windows only.

reading posted:

Has anyone had luck creating a ram disk and using it for Steam games in linux? I had trouble getting steam to recognize that I already had a certain game's files on my ramdisk. There aren't any available utilities either, everything that shows up in a web search is only for windows.

Then I also unmounted the ramdisk without realizing I needed to create an image, so, lost all the local files...

I haven't had any problems with the steamapps dir being a symlink and sometimes just dumping the files in there. Only thing I can think of is to be sure you copy the appropriate appmanifest_12345.acf file too. (Also I don't think having steam running while you're messing with its files would be good.)

Polygynous fucked around with this message at 15:15 on Jul 12, 2014

reading
Jul 27, 2013

evol262 posted:

What do you mean by utilities? You can just mount -t tmpfs somewhere.

It'll probably need to be wherever the working directory is (~/path/to/steam/games). What did you try and what didn't work about it?

Part of this is just a Steam issue - the game's local content was only 3600MB, so I created a 4G ramdisk, but then when I deleted the local content on my harddrive and tried to re-install the game onto the ramdisk (where I had copied all the files) Steam insisted that it needed more than 7 gigs to install. So, it wouldn't get to the point where it looked for pre-existing files before downloading, which is the point where it was supposed to find all the files I had copied.

Now I created a 7G ramdisk (seems risky since I only have 8G of ram) and I'm downloading the game to that directly. Steam is telling me conflicting things about how much it has downloaded, how much it thought it needed (7G) and how much it has actually downloaded (about 3.1G so far, looks to be on track for only 3.6G).

I figure once it's installed on to that, I will save an image of the disk (Correct me if I'm wrong: is that just tar'ing and gzip'ing the directory onto my HD?) and next time I mount it, I'll just mount it as a 4G sized disk.

pipebomb
May 12, 2001

Dear God, what is it like in your funny little brains?
It must be so boring.
Oh man, i am out of practice badly.

I am waiting for someone to change name servers at godaddy, which they probably won't do until Monday. But I need to verify that the site is working properly on my end. How do I get the site to show using

server_IP/~dirname ?

Just the directive is fine, I can google the rest, but I'm tired and stuck...

[edit] vhost mod alias is what I want i think

pipebomb fucked around with this message at 17:03 on Jul 12, 2014

hifi
Jul 25, 2012

pipebomb posted:

Oh man, i am out of practice badly.

I am waiting for someone to change name servers at godaddy, which they probably won't do until Monday. But I need to verify that the site is working properly on my end. How do I get the site to show using http://server ?

Just the directive is fine, I can google the rest, but I'm tired and stuck...

With the hosts file (man hosts should tell you everything you want)

pseudorandom name
May 6, 2007

reading posted:

Part of this is just a Steam issue - the game's local content was only 3600MB, so I created a 4G ramdisk, but then when I deleted the local content on my harddrive and tried to re-install the game onto the ramdisk (where I had copied all the files) Steam insisted that it needed more than 7 gigs to install. So, it wouldn't get to the point where it looked for pre-existing files before downloading, which is the point where it was supposed to find all the files I had copied.

Now I created a 7G ramdisk (seems risky since I only have 8G of ram) and I'm downloading the game to that directly. Steam is telling me conflicting things about how much it has downloaded, how much it thought it needed (7G) and how much it has actually downloaded (about 3.1G so far, looks to be on track for only 3.6G).

I figure once it's installed on to that, I will save an image of the disk (Correct me if I'm wrong: is that just tar'ing and gzip'ing the directory onto my HD?) and next time I mount it, I'll just mount it as a 4G sized disk.

Be sure to compare performance of your RAM disk to using readahead on the game or doing not actually doing anything, all this effort is probably a waste of time.

pipebomb
May 12, 2001

Dear God, what is it like in your funny little brains?
It must be so boring.

hifi posted:

With the hosts file (man hosts should tell you everything you want)

poo poo, forums ate my code. I meant:

server_IP/~dirname

taqueso
Mar 8, 2004


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

:pirate::hf::tinfoil:

reading posted:

7G ramdisk (seems risky since I only have 8G of ram)

If you use tmpfs, the system will automatically use swap to hold (part or all of, as needed) the ramdisk if memory pressure warrants doing so. Just make sure you have enough swap to handle it. You can even have a tmpfs larger than RAM. It is also smart enough to not allocate anything for the unused part of the tmpfs. (IIRC you can make a tmpfs bigger than RAM+swap as long as you don't actually use all of it)

Dunno about the steam part of your post, though...

taqueso fucked around with this message at 17:03 on Jul 12, 2014

Adbot
ADBOT LOVES YOU

evol262
Nov 30, 2010
#!/usr/bin/perl

reading posted:

Part of this is just a Steam issue - the game's local content was only 3600MB, so I created a 4G ramdisk, but then when I deleted the local content on my harddrive and tried to re-install the game onto the ramdisk (where I had copied all the files) Steam insisted that it needed more than 7 gigs to install. So, it wouldn't get to the point where it looked for pre-existing files before downloading, which is the point where it was supposed to find all the files I had copied.

Now I created a 7G ramdisk (seems risky since I only have 8G of ram) and I'm downloading the game to that directly. Steam is telling me conflicting things about how much it has downloaded, how much it thought it needed (7G) and how much it has actually downloaded (about 3.1G so far, looks to be on track for only 3.6G).

I figure once it's installed on to that, I will save an image of the disk (Correct me if I'm wrong: is that just tar'ing and gzip'ing the directory onto my HD?) and next time I mount it, I'll just mount it as a 4G sized disk.

If you're using ramfs, don't. Use tmpfs, which is also in-memory, but can be swapped as normal (as mentioned by taqueso).

What you should be doing is basically:

Install the game on your HD. Stop steam. tar or rsync -ar the app directory somewhere else, mount tmpfs on the actual location (or a symlink from shm or a filesystem already mounted tmpfs), and rsync/untar it back. Restart steam. You don't need to "reinstall" it. You can mount on top of regular directories and the mountpoint will mask it.

"ls -l /somedir && rsync -avr /somedir/* /tmp/gamedir/ && sudo mount -o bind /tmp/gamedir /somedir && ls -l /somedir" will show no differences. But "mount |grep somedir" after this will show you that it's mounted tmpfs (a ramdisk).

Don't go through uninstall/reinstall hoops or anything. Add a startup script in your X session or rc.local which does this rsync and bind mount and you won't have to worry about it ever gain.

You should not be using ramfs. You should not need to worry about what "size" the disk is. tmpfs will handle all of that for you.

Bluntly, though, this is a total waste of time, especially if you're on an SSD. An incalculable amount of time has gone into caching and paging performance in the kernel, and readahead is awfully good at predicting this. Plus games are better about splitting, caching, and reusing resources. I get that this is some gamer thing which was also popular 20 years ago, but it's unlikely to make much of a difference for the effort you put into it.

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