I can do comparisons with tab delimited files from command line such as :
bro -i eth1 malware_test_ips.bro
But whenever I install the same script to the site area, the comparisons are not made!! In fact it seems it is not reading the very same tab delimited file. Below is the read function. Why would this work on command line not on broctl deploy, despite showing no errors or warnings? Is there a file read setting im missing?
Input::add_table([$source=sinkhole_list_location, $name="sinkhole", $idx=Idx, $val=Val, $destination=sinkhole_list2, $mode=Input::REREAD]);
I have just solved this. I had to use the #DIR to refer to the sinkhole_list_location for the file. Either this or the full file pathway.
It works from command line because the file is local to the command, local pathway.
Related
I use flex on cygwin package for Windows to build lexical analyzer.
I created file test.lex with rules
When i use this commands in command line
flex -i test.lex
cc lex.yy.c -lfl
./a
It works fine. But when i tried to make sh file (compile_flex.sh) with this commands and run file
./compile_flex.sh
I received error
flex: can't open test.lex
I tried to put different paths to my file
~/test.lex
/home/user/test.lex
c:\\cygwin64\\home\\user\\test.lex
But it doesn't work! I always receive message that file not found.
When I put command
vi test.lex
In my .sh file it works good and file is opened in vim
I figured out with my problem. I use windows editor (notepad++) for create .sh file. When I changed line separator from \n\r to \n in preferences, it was working fine
I have a Windows dedicated server and I installed Multicraft to run Minecraft servers, and I wanted to add a accept EULA button, since I did not know much about bat files, so I found a sh file online and I did not want to use Cygwin because I don't know how to install it and make it run properly.
I want to change this to a .bat file:
#!/bin/sh echo 'eula=true' > "$SERVER_DIR/eula.txt"
it basically finds the line eula=false in eula.txt and changes it to true from what i understand
I would guess that this is what you're looking for:
echo eula=true>>%SERVER_DIR%\eula.txt
Given the double greater-than symbol it should append the line to the indicated file. Note that we're using a backslash here. You might want to look at the contents of that SERVER_DIR environment variable to see if it will work on a Windows-based computer.
If you want to mirror the behavior in the UNIX script then use a single greater-than symbol to overwrite the file content.
When I pipe output to a file in a cron job using the > operator, it always appends a ^M to the end of the file name. This shows up as a ? when I run ls in the directory but reveals itself as ^M when I edit the file in nano and go to save.
For example this command:
locale > locale.txt
Outputs a file named "locale.txt?" (i.e. "locale.txt^M")
I don't know why it does this, but I'm guessing it has something to do with environment variables. When I use > from a terminal it behaves properly. I've searched Google for this problem but apparently it doesn't like all these special characters in the query so I haven't found anything.
I've tried using mv to change the file name back to normal but it doesn't recognize the ? or the ^M character when I type in the file name.
I've seen that perhaps this is the carriage return "\r" character but I don't know why cron would put a Windows newline on the end of my file name. All help is appreciated. Thanks!
The problem is with the cron or script file itself: it has DOS line separators (CRLF) instead of Unix (LF only). You can fix it using dos2unix.
Originally I thought this was a db administration issue, but I think the lines have become a little blurred. I'm going to keep this strictly a scripting problem here. If you want more background info I posted this on ServerFault here:
https://serverfault.com/questions/511780/postgresql-pgdump-script-on-rhel5-failed-fe-sendauth-no-password-supplieddat
My Script
I distilled my original script down to this to keep things simple. This is what I have in a .sh named pg_dump_script:
/home/myusername/lappstack-1.2-5/postgresql/bin/pg_dump --host=127.0.0.1 --port=5433 --username=myusername mydbname
When I run this I get the following error:
$ bash pg_dump_script.sh
Password:
" does not exist database "corenection to database "mydbname
I can copy and paste the line in the script file and run it from the command line and everything works fine.
Here are the permission on the script file:
-rwxr-xr-x
I used chmod 755
I'm not sure what I'm doing wrong here? I'm not an expert on scripting, but I thought if I could run it from the console it would of course run fine from a script. Let me know if any information is needed. I'm trying to keep this simple.
Updates
I removed all parameters. This is all the text in the .sh
/home/myusername/lappstack-1.2-5/postgresql/bin/pg_dump
I receive this error:
$ ./pg_dump_script.sh
: No such file or directoryine 1: /home/myusername/lappstack-1.2-5/postgresql/bin/pg_dump
: command not foundst.sh: line 2:
Run dos2unix on your .sh file to convert to proper UN*X line endings and it should work:
dos2unix pg_dump_script.sh
When editing with vi check to make sure it's not in dos edit mode. If you start with an original text file with CR/LF in it, vi will automatically go into dos mode unless you tell it otherwise.
I installed ender js and am running it from the command line. It generates a file called ender.js. Whenever I run the command "ender info" or anything with ender in it, it opens the ender.js file in notepad.
How can I stop the file from opening and get the command to run? It runs when I delete the file, but I need the file.
Windows runs it's own JS executor in the command line. This is in the PATHEXT system variable. This system variable stores an order for file extensions to be executed if there are files in the current directory that match. When I remove JS from that list, the command I am trying to call works. It does mean I won't be able to execute JS files in the browser now, but I have never needed to do that so far.
So uou are trying to run a javascript from the command line? that is what i infered here sorry if i am incorrect. That is done with the C:> cscript jslint.js command from the command line.
You can usually get around this by typing ender.cmd or ender.bat (depends how it is installed).