Search Results

Search: Posts Made By: drysdalk
556
Posted By drysdalk
Hello, OK, here's a quick hacked-together...
Hello,

OK, here's a quick hacked-together version of a script that more-or-less does what crond would do. As Neo has mentioned however, this is not the best idea, as you're kind of needlessly...
556
Posted By drysdalk
Hi, In that case, you'd really be into the...
Hi,

In that case, you'd really be into the territory of literally re-inventing crontab. For example, you could define an input file format that consisted of runtimes and their associated...
556
Posted By drysdalk
Hi, Using the approach from my script, you...
Hi,

Using the approach from my script, you would just tweak the runtime variable accordingly. For instance, in the provided example:


runtime=`/usr/bin/date -d '2019-08-09 14:22:00' +%s`

...
556
Posted By drysdalk
Hi, If you definitely don't have access to...
Hi,

If you definitely don't have access to the crontab for the user you want to run the script as, and if you can't get the person who has root on the box in question to set it up for you, then...
438
Posted By drysdalk
Hello, Yes, that's correct - this error...
Hello,

Yes, that's correct - this error means that the user myuser is not allowed to run the su command via sudo. That's not unusual, and in fact is generally good practice. If you let regular...
438
Posted By drysdalk
Hi, As Neo has said, the most likely...
Hi,

As Neo has said, the most likely explanation here is that myuser has a valid shell set in /etc/passwd, whereas webuser does not.

Witness the following example:


# finger -l unixforum...
2,342
Posted By drysdalk
Hi, The sed command can take care of this...
Hi,

The sed command can take care of this for you:


$ cat test.txt
,001E:001F,,,02EE,0FED:0FEF,
$ sed -i 's/^,//g;s/,$//g' test.txt
$ cat test.txt
001E:001F,,,02EE,0FED:0FEF


The...
1,151
Posted By drysdalk
Hi, Assuming you're using Bash as your...
Hi,

Assuming you're using Bash as your shell, this is the ideal situation for the case statement. Consider the following example:


$ cat data.txt
Jog
mog
cat
dog
jug
Man
$ cat...
1,331
Posted By drysdalk
Hi, In terms of your script itself as a...
Hi,

In terms of your script itself as a solution to your problem, a change like this should work:


#!/bin/bash
IP=$1
first_port=$2
last_port=$3
function scanner

{
for...
4,908
Posted By drysdalk
Hi, On most Linux systems, the /boot...
Hi,

On most Linux systems, the /boot directory holds the files that the system needs in order to boot. Note that this is meant quite literally - it holds purely the files needed for booting, i.e....
261
Posted By drysdalk
Hi, In theory, this should be fairly...
Hi,

In theory, this should be fairly straightforward. If you want to delete all files created from 2017 and beyond (i.e. also files from 2016, 2015, etc - anything older than 2017), then you...
1,332
Posted By drysdalk
Hi, There's a few ways to approach this, but...
Hi,

There's a few ways to approach this, but using the find command as you're starting to do will certainly do the trick. However, as things stand, your find command isn't actually going to do...
2,931
Posted By drysdalk
Hi, This would to me indicate that something...
Hi,

This would to me indicate that something has gone wrong when you copied-and-pasted the script code into your terminal. The ^M character is used by Windows to mark the end of lines in a file,...
2,931
Posted By drysdalk
Hi, I'm not quite sure what could have gone...
Hi,

I'm not quite sure what could have gone wrong, since I'm not seeing any sign of you having run the script or the output file being created here. If you run the version of the script that I...
2,931
Posted By drysdalk
Hi, I think you're very nearly there, but...
Hi,

I think you're very nearly there, but perhaps have just over-complicated things a bit. You can do all this with just the one input file, the one output file, and the groups command.

Here's...
561
Posted By drysdalk
Hi, One way to do this would be to take the...
Hi,

One way to do this would be to take the output of your awk command, and directly use that via command substitution as input for the date command to work on.

In the following example, we...
1,768
Posted By drysdalk
Hi, Yes, the issue here is most likely to be...
Hi,

Yes, the issue here is most likely to be zenity, as you say. zenity is a utility for displaying dialog boxes in an X Windows graphical environment. If you're running this server headless...
335
Posted By drysdalk
Hello, My initial thought was that this...
Hello,

My initial thought was that this would be straightforward, and something like this one line of awk would work:


$ cat test.txt
1234 84 test1 file:about user_detials(bankUser) :jpeg 10...
331
Posted By drysdalk
Hi, I think there are two main questions...
Hi,

I think there are two main questions here: firstly, when you say that it "is not quite working", what is going wrong ? Are you getting an error, or do you find that the idle message is never...
258
Posted By drysdalk
Hello, On my test environment (Linux with...
Hello,

On my test environment (Linux with GNU userland), something like this would appear to do what you need:


$ pwd
/home/unixforum/279952
$ ls
f123456grKNI foo/
$ ls foo
f11223grKE...
942
Posted By drysdalk
Hi, Aside from missing out the $ before your...
Hi,

Aside from missing out the $ before your variable name as has been pointed out, the other problem you'll have here is that you have to cast your temperature variable (which is a floating-point...
942
Posted By drysdalk
Hi, I'd just included that as a...
Hi,

I'd just included that as a demonstration of how if works, really, so you could get an idea of what you need to do in your own code. So rather than directly using my example script, you'd...
942
Posted By drysdalk
Hi, If all you're looking for is a way in...
Hi,

If all you're looking for is a way in Bash to test the value of a number, then the if statement can handle that on its own.

For example, here's a script that will test a previously-defined...
464
Posted By drysdalk
Hi, I'm not entirely clear on what could...
Hi,

I'm not entirely clear on what could have caused a reboot here - from the output you've provided it seems that after five seconds the script proceeded to kill the previously-backgrounded...
464
Posted By drysdalk
Hi, One modification you could make here...
Hi,

One modification you could make here would be to change the line defining maxruntime to this instead:


maxruntime=$1


The variable $1 has a special meaning referring to the first...
Showing results 1 to 25 of 265

 

Featured Tech Videos

All times are GMT -4. The time now is 09:05 PM.
Unix & Linux Forums Content Copyright 1993-2019. All Rights Reserved.
Privacy Policy