I am new to Lua scripting language and I am getting the following error while connecting it to the local redis server - redis

I am new to Lua scripting language and I am getting the following error while connecting it to the local redis server
ERR user_script:2: Script attempted to access nonexistent global variable 'require
' script: a97a3c34edbccf96c1b21c2f604411d895e2a452, on #user_script:2.
Here is my code
local redis = require "redis"
local csv = require "csv"

Related

Azure SQL | PowerShell ISE vs PowerShell CLI - attempt was made to access a socket in a way forbidden by its access permissions

I have a really frustrating situation here. There is a PowerShell script that logs into the Azure SQL, queries table, and saves results into the .csv file. Connection string looks like this:
$DatabaseUrl = "mycompany-***-***-dev-use4-01.database.windows.net"
$DatabaseName = "MyDataBase"
$conn = New-Object System.Data.SqlClient.SQLConnection
$conn.ConnectionString = "Data Source=$DatabaseUrl;Initial Catalog=$DatabaseName;Connect Timeout=20"
$conn.AccessToken = $token
$conn.Open
On $conn.Open line the script throws this error:
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: TCP Provider, error: 0 - An
attempt was made to access a socket in a way forbidden by its access permissions
Now, the frustration comes when this script works perfectly fine in PowerShell ISE, but not in PowerShell CLI (command line). I have searched millions of posts probably by now, still not finding any solution. I tried to run CLI as an administrator, tried to Import-Module -SQLServer -Scope CurrentUser and others. Honestly, I have absolutely no idea why the script would work in ISE but not in CLI. Are those 2 different environments/scripting languages? Thank you for all your help

cannot run passed Lua script to Redis: This Redis command is not allowed from scripts

I have three instances of Redis server running sentinel and a Lua script in order to let the redis_exporter gather the list of connected clients to the Redis server. but when I pass the script to the redis-cli command I get the following error:
(error) ERR Error running script (call to f_4c6be190ef2981eda70d58ec0c959bd1ca2c5352): #user_script:10: #user_script: 10: This Redis command is not allowed from scripts
This is my Lua script:
local r = redis.call("CLIENT", "LIST")
return r
Is there any way to fix this problem?
A quick google seems the issue is coming from the redis server itself, not the library.
The CLIENT command has a no-script flag
https://github.com/antirez/redis/blob/fe5aea38c35e3fc35a744ad2de73543df553ae48/src/sentinel.c

Getting the output of a script run on a remote server over ssh by a C# test

I'm writing automation tests in .net core that will access a remote server running the application we're testing. I'm currently ssh-ing onto a remote server in the test to run a script that verifies certain data. I want to get the output from that script to my local machine, so my test can know whether that step passed or not.
I am using the Renci.SshNet tool to connect to the remote server.
Here is the code I run in my test to connect to the remote host, then send a command as a string.
string commandToRun = "/opt/scriptHome/scriptWithOutput";
using (var client = new SshClient(ipAddress, username, password))
{
client.Connect();
client.RunCommand(commandToRun);
client.Disconnect();
}
RunCommand returns an object of type SshCommand and you can use its properties to check the result of your command for example:
var command = client.RunCommand(commandToRun);
Console.WriteLine(command.Result);

Apache Chroot - ibase_connect failure

Apache 2, running mod_chroot. Can access basic html and php script fine.
This test script works fine using cli php, so I know connection string is fine.
$host = '127.0.0.1:pubdata';
$password ="*******";
$username="SYSDBA";
$dbh = ibase_connect($host, $username, $password);
.. do query etc
However, when I run this under Chrooted Apache, it returns an error message:
Warning: ibase_connect(): Can't access lock files' directory /tmp/firebird in /html/app/webroot/test2.php
This seems really strange. /tmp/firebird exists and is used by firebird when script by CLI.
When I compiled the PHP I used --with-interbase=/opt/firebird/
Hope this makes sense and someone has a thought!
Try to use Always localhost: in front or another external IP before connecting and also restart apache + firebird before connecting
My guess is that you use Classic or SuperClassic firebird and it tries to attach to /tmp and db directly
http://firebird.1100200.n4.nabble.com/Fwd-Have-you-tried-firebird-2-5-SuperClassic-from-the-packages-td3053790.html
ps:
Also Once chrooted, Apache cannot access anything located above ChrootDir

bcp error while exporting data using management studio in sql 2005 express but not using DOS

i am using sql server 2005 express edition .
when i export data via bcp utility using dos prompt then there is no error ,
but when i created a stored procedure for the export process and use management studio express for exporting data then it gives the following error :
SQLState = S1000, NativeError = 0
Error = [Microsoft][SQL Server Native Client 10.0]Unable to open BCP host data-file
Please help.
I had the same issue, but the answer is that I was being less than bright.
As the command was being run on a server, not my local machine, it was trying to write to a non-existent folder on the server. It was executing successfully against the root of C: but not against my share folder, C:\share. The problem for me was that I was looking for the file in the root of my C Drive, not the servers.
When I changed the path to \mymachinename\share, everything worked.
When you run the bcp utility using the DOS command line you are using the logged in persons credentials (usually your own), but when running as a stored procedure you are using the credentials of the SQL server process, which usually is configured to have much less permissions than ordinary users in order to provide safety against various attacks.
Check in the Services list of which user is used for the SQL server database engine and check if that user has enough read/write permissions to the directories and files involved.